-
Notifications
You must be signed in to change notification settings - Fork 77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Atividade 6 - Equipe 2 #318
base: master
Are you sure you want to change the base?
Changes from 20 commits
11c3f20
1f53279
efcccd8
b854e8c
5cfeb3f
e006415
ba67c37
5161e02
e14892d
45c8ce9
4c534e5
660d043
5e79621
0d7b128
af6da1d
b103fa9
1ca79b5
b42bf9c
aed0431
fe722bc
f0cc1ba
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,5 +35,9 @@ | |
</featureGroup> | ||
</feature> | ||
|
||
|
||
<feature min="0" max="1" name="ResearchProject" type="NONE" id="ResearchProject"> | ||
<featureGroup min="0" max="1" id="filtrar"> | ||
<feature min="0" max="1" name="Filter_ResearchProject" type="NONE" id="Filter_ResearchProject"></feature> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Extração de nova feature para filtragem de Projetos de Pesquisa. |
||
</featureGroup> | ||
</feature> | ||
</feature> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
//#if($researchProject) | ||
package rgms.researchProject | ||
|
||
import org.apache.shiro.SecurityUtils | ||
import org.springframework.dao.DataIntegrityViolationException | ||
import rgms.authentication.User | ||
|
||
class ResearchProjectController { | ||
|
||
|
@@ -20,6 +22,19 @@ class ResearchProjectController { | |
[researchProjectInstance: new ResearchProject(params)] | ||
} | ||
|
||
def myProjects() { | ||
User user = User.findByUsername(SecurityUtils.subject.principal); | ||
List<ResearchProject> projectsList = ResearchProject.findAllByResponsible(user.getAuthor().getName()); | ||
render(view: '/researchProject/list', model: [researchProjectInstanceList: projectsList, researchProjectInstanceTotal: projectsList.size()]); | ||
} | ||
|
||
//#if($Filter_ResearchProject) | ||
def filter(String projectName) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Implementação de variabilidade da nova feature usando anotação. Devido ao fato de ser uma action, não foi possível utilizar um mecanismo de aspectos utilizando closures ou mixins. Não foi utilizado o Filters de Grails devido à impossibilidade de modularizá-lo em um pacote específico, ou ainda Interceptor pois o código ficaria espalhado em vários lugares do controller. |
||
List<ResearchProject> projectsList = ResearchProject.findAllByProjectName(projectName); | ||
render(view: '/researchProject/list', model: [researchProjectInstanceList: projectsList, researchProjectInstanceTotal: projectsList.size()]); | ||
} | ||
//#end | ||
|
||
def save() { | ||
def researchProjectInstance = new ResearchProject(params) | ||
saveInstance(researchProjectInstance,"create",'default.created.message') | ||
|
@@ -33,7 +48,7 @@ class ResearchProjectController { | |
_processResearchProject(id) | ||
} | ||
|
||
def _processResearchProject(Long id){ | ||
private def _processResearchProject(Long id){ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hide Method |
||
|
||
def researchProjectInstance = getResearchProjectInstance(id) | ||
|
||
|
@@ -44,7 +59,7 @@ class ResearchProjectController { | |
[researchProjectInstance: researchProjectInstance] | ||
} | ||
|
||
def getResearchProjectInstance(Long id){ | ||
private def getResearchProjectInstance(Long id){ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hide Method |
||
def researchProjectInstance = ResearchProject.get(id) | ||
|
||
if (!researchProjectInstance) { | ||
|
@@ -77,7 +92,7 @@ class ResearchProjectController { | |
saveInstance(researchProjectInstance,"edit",'default.updated.message') | ||
} | ||
|
||
def void saveInstance(ResearchProject researchProjectInstance, String view, String code) { | ||
private def void saveInstance(ResearchProject researchProjectInstance, String view, String code) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hide Method |
||
if (!researchProjectInstance.save(flush: true)) { | ||
render(view: view, model: [researchProjectInstance: researchProjectInstance]) | ||
return | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
package rgms.member | ||
|
||
import rgms.authentication.User | ||
import rgms.publication.Publication | ||
import rgms.publication.ResearchLine | ||
|
||
|
@@ -17,6 +18,7 @@ class Member { | |
Boolean active | ||
String access_token | ||
String facebook_id | ||
User user | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Change Unidirectional Association to Bidirectional |
||
|
||
//static hasMany = [roles: Role, permissions: String, #if($History) historics: Record,#end memberships : Membership, publications: Publication] | ||
static hasMany = [historics: Record, memberships : Membership, publications: Publication, researchLines: ResearchLine] | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Build entries de nova feature extraída para filtragem de Projetos de Pesquisa.