Subversion Repositories bacoAlunos

Rev

Rev 208 | Rev 489 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
112 jmachado 1
package pt.estgp.estgweb.domain;
2
 
146 jmachado 3
import java.io.Serializable;
204 jmachado 4
import java.util.List;
146 jmachado 5
 
112 jmachado 6
/**
7
 * Created by IntelliJ IDEA.
8
 * User: Jorge Machado
9
 * Date: 7/Mai/2008
10
 * Time: 20:21:15
11
 * To change this template use File | Settings | File Templates.
12
 */
204 jmachado 13
public class CourseUnitImpl extends CourseUnit implements ICanManage
146 jmachado 14
{
15
    public 1.5.0/docs/api/java/io/Serializable.html">Serializable getSerializable()
16
    {
17
        return getId();
18
    }
204 jmachado 19
 
20
    public boolean isValid()
21
    {
22
        return true;  //To change body of implemented methods use File | Settings | File Templates.
23
    }
24
 
25
    public boolean isOwnedBy(GenericUser u)
26
    {
208 jmachado 27
        return isOwnedBy(u, false);
204 jmachado 28
    }
29
 
208 jmachado 30
    public boolean isOwnedBy(GenericUser u, boolean transaction)
31
    {
32
        return u != null && u instanceof TeacherImpl && ((TeacherImpl)u).hasCourseUnit(getId(),transaction);
33
    }
34
 
204 jmachado 35
    /**
36
     * Not implemented can be variuous teachers
37
     * @return null
38
     * use isOwnedBy in this class
39
     */
40
    public GenericUser getOwner()
41
    {
42
        return null;
43
    }
44
    /**
45
     * Not implemented
46
     * @return
47
     */
48
    public List<String> getOwnerRoles()
49
    {
50
        return null;
51
    }
52
 
53
    /**
54
     * Not implemented
55
     * @return
56
     */
57
    public 1.5.0/docs/api/java/lang/String.html">String getChoosedOwnerRole()
58
    {
59
        return null;
60
    }
61
 
62
    public boolean isInternal()
63
    {
251 jmachado 64
        return true;
204 jmachado 65
    }
208 jmachado 66
 
67
    public CourseUnitBlogImpl getUnitBlog()
68
    {
69
        if(getBlogs()!=null && getBlogs().size() > 0)
70
            return (CourseUnitBlogImpl) getBlogs().iterator().next();
71
        return null;
72
    }
251 jmachado 73
 
74
    public boolean equals(5+0%2Fdocs%2Fapi+Object">Object anotherInstance)
75
    {
76
        if(anotherInstance instanceof CourseUnitImpl)
77
        {
78
            CourseUnitImpl anCourseUnit = (CourseUnitImpl) anotherInstance;
79
            return anCourseUnit.getCode() != null && getCode() != null && getCode().equals(anCourseUnit.getCode()) &&
80
                   anCourseUnit.getCourseCode() != null && getCourseCode() != null && getCourseCode().equals(anCourseUnit.getCourseCode()) &&
81
                   anCourseUnit.getSemestre() != null && getSemestre() != null && getSemestre().equals(anCourseUnit.getSemestre()) &&
82
                   anCourseUnit.getImportYear() != null && getImportYear() != null && getImportYear().equals(anCourseUnit.getImportYear());
83
        }
84
        return false;
85
 
86
    }
112 jmachado 87
}