Skip to content
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

Open
wants to merge 21 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 20 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
164 changes: 164 additions & 0 deletions ProductGeneration/ck.xml
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,20 @@
<args>visit</args>
</transformation>
</configuration>
<configuration>
<expression>ResearchProject</expression>
<transformation>
<name>createBuildEntries</name>
<args>ResearchProject</args>
</transformation>
</configuration>
<configuration>
<expression>Filter_ResearchProject</expression>
Copy link
Contributor Author

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.

<transformation>
<name>createBuildEntries</name>
<args>Filter_ResearchProject</args>
</transformation>
</configuration>
<configuration>
<expression>rgms</expression>
<transformation>
Expand Down Expand Up @@ -1175,4 +1189,154 @@
<args>FacebookController,grails-app/controllers/rgms/tool/FacebookController.groovy</args>
</transformation>
</configuration>

<configuration>
<expression>ResearchProject</expression>
<transformation>
<name>selectAndMoveComponent</name>
<args>formResearchProject,grails-app/views/researchProject/_form.gsp</args>
</transformation>
</configuration>
<configuration>
<expression>ResearchProject</expression>
<transformation>
<name>selectAndMoveComponent</name>
<args>createResearchProject,grails-app/views/researchProject/create.gsp</args>
</transformation>
</configuration>
<configuration>
<expression>ResearchProject</expression>
<transformation>
<name>selectAndMoveComponent</name>
<args>editResearchProject,grails-app/views/researchProject/edit.gsp</args>
</transformation>
</configuration>
<configuration>
<expression>ResearchProject</expression>
<transformation>
<name>selectAndMoveComponent</name>
<args>listResearchProject,grails-app/views/researchProject/list.gsp</args>
</transformation>
</configuration>
<configuration>
<expression>ResearchProject</expression>
<transformation>
<name>selectAndMoveComponent</name>
<args>showResearchProject,grails-app/views/researchProject/show.gsp</args>
</transformation>
</configuration>

<configuration>
<expression>ResearchProject</expression>
<transformation>
<name>selectAndMoveComponent</name>
<args>researchProject,grails-app/domain/rgms/ResearchGroup/ResearchGroup.groovy</args>
</transformation>
</configuration>
<configuration>
<expression>ResearchProject</expression>
<transformation>
<name>preprocessFiles</name>
<args>grails-app/domain/rgms/ResearchGroup/ResearchGroup.groovy</args>
</transformation>
</configuration>
<configuration>
<expression>ResearchProject</expression>
<transformation>
<name>selectAndMoveComponent</name>
<args>researchProjectController,grails-app/controllers/rgms/researchProject/ResearchProjectController.groovy</args>
</transformation>
</configuration>
<configuration>
<expression>ResearchProject</expression>
<transformation>
<name>preprocessFiles</name>
<args>grails-app/controllers/rgms/researchProject/ResearchProjectController.groovy</args>
</transformation>
</configuration>
<configuration>
<expression>ResearchProject</expression>
<transformation>
<name>selectAndMoveComponent</name>
<args>ResearchProjectFeature,test/cucumber/ResearchProject.feature</args>
</transformation>
</configuration>
<configuration>
<expression>ResearchProject</expression>
<transformation>
<name>preprocessFiles</name>
<args>test/cucumber/ResearchProject.feature</args>
</transformation>
</configuration>
<configuration>
<expression>ResearchProject</expression>
<transformation>
<name>selectAndMoveComponent</name>
<args>XMLServiceResearchProjectAspect,grails-app/services/rgms/XMLServiceResearchProjectAspect.groovy</args>
</transformation>
</configuration>
<configuration>
<expression>ResearchProject</expression>
<transformation>
<name>preprocessFiles</name>
<args>grails-app/services/rgms/XMLServiceResearchProjectAspect.groovy</args>
</transformation>
</configuration>
<configuration>
<expression>ResearchProject</expression>
<transformation>
<name>preprocessFiles</name>
<args>grails-app/services/rgms/XMLService.groovy</args>
</transformation>
</configuration>
<configuration>
<expression>ResearchProject</expression>
<transformation>
<name>preprocessFiles</name>
<args>grails-app/controllers/rgms/publication/XMLController.groovy</args>
</transformation>
</configuration>

<configuration>
<expression>ResearchProject</expression>
<transformation>
<name>selectAndMoveComponent</name>
<args>ResearchProjectSteps,test/cucumber/steps/ResearchProjectSteps.groovy</args>
</transformation>
</configuration>
<configuration>
<expression>ResearchProject</expression>
<transformation>
<name>selectAndMoveComponent</name>
<args>ResearchProjectTestDataAndOperations,test/functional/steps/ResearchProjectTestDadaAndOperations.groovy</args>
</transformation>
</configuration>
<configuration>
<expression>ResearchProject</expression>
<transformation>
<name>selectAndMoveComponent</name>
<args>ResearchProjectPage,test/functional/pages/researchProject/ResearchProjectPage.groovy</args>
</transformation>
</configuration>
<configuration>
<expression>ResearchProject</expression>
<transformation>
<name>selectAndMoveComponent</name>
<args>ResearchProjectCreatePage,test/functional/pages/researchProject/ResearchProjectCreatePage.groovy</args>
</transformation>
</configuration>
<configuration>
<expression>ResearchProject</expression>
<transformation>
<name>selectAndMoveComponent</name>
<args>ResearchProjectEditPage,test/functional/pages/researchProject/ResearchProjectEditPage.groovy</args>
</transformation>
</configuration>
<configuration>
<expression>ResearchProject</expression>
<transformation>
<name>selectAndMoveComponent</name>
<args>ResearchProjectShowPage,test/functional/pages/researchProject/ResearchProjectShowPage.groovy</args>
</transformation>
</configuration>
</configurationModel>
19 changes: 19 additions & 0 deletions ProductGeneration/componentModel.txt
Original file line number Diff line number Diff line change
Expand Up @@ -219,3 +219,22 @@ ArticleEditPage => test/functional/pages/ArticleEditPage.groovy;
ArticleShowPage => test/functional/pages/ArticleShowPage.groovy;
ArticlePage => test/functional/pages/ArticlesPage.groovy;
UserRegisterPage => test/functional/pages/UserRegisterPage.groovy;

formResearchProject => grails-app/views/researchProject/_form.gsp;
createResearchProject => grails-app/views/researchProject/create.gsp;
editResearchProject => grails-app/views/researchProject/edit.gsp;
listResearchProject => grails-app/views/researchProject/list.gsp;
showResearchProject => grails-app/views/researchProject/show.gsp;

researchProject => grails-app/domain/rgms/ResearchGroup/ResearchGroup.groovy;
researchProjectController => grails-app/controllers/rgms/researchProject/ResearchProjectController.groovy;
XMLServiceResearchProjectAspect => grails-app/services/rgms/XMLServiceResearchProjectAspect.groovy

ResearchProjectFeature => test/cucumber/ResearchProject.feature;
ResearchProjectSteps => test/cucumber/steps/ResearchProjectSteps.groovy;
ResearchProjectTestDataAndOperations => test/functional/steps/ResearchProjectTestDadaAndOperations.groovy;
ResearchProjectPage => test/functional/pages/researchProject/ResearchProjectPage.groovy;
ResearchProjectCreatePage => test/functional/pages/researchProject/ResearchProjectCreatePage.groovy;
ResearchProjectEditPage => test/functional/pages/researchProject/ResearchProjectEditPage.groovy;
ResearchProjectShowPage => test/functional/pages/researchProject/ResearchProjectShowPage.groovy;

6 changes: 5 additions & 1 deletion ProductGeneration/featureModel.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Copy link
Contributor Author

Choose a reason for hiding this comment

The 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>
11 changes: 5 additions & 6 deletions grails-app/controllers/rgms/publication/XMLController.groovy
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package rgms.publication

import org.apache.shiro.SecurityUtils
import org.springframework.web.multipart.MultipartHttpServletRequest
import org.springframework.web.multipart.commons.CommonsMultipartFile
import rgms.XMLService
import rgms.authentication.User
import rgms.member.Member
Expand Down Expand Up @@ -62,14 +64,11 @@ class XMLController {
XMLService.createResearchLines(xmlFile)
}

//#if($researchProject)
def uploadXMLResearchProject() {
XMLService.Import(saveReseachProject, returnWithMessage, 'default.researchproject.import.flashmessage.success', "ResearchProject", request)
}

private Closure saveReseachProject = {
Node xmlFile ->
XMLService.createResearchProjects(xmlFile)
XMLService.Import(XMLService.saveResearchProject, returnWithMessage, 'default.researchproject.import.flashmessage.success', "ResearchProject", this.request)
}
//#end

def uploadXMLBookChapter() {
String flashMessage = 'The non existent Book Chapters were successfully imported'
Expand Down
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 {

Expand All @@ -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) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The 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')
Expand All @@ -33,7 +48,7 @@ class ResearchProjectController {
_processResearchProject(id)
}

def _processResearchProject(Long id){
private def _processResearchProject(Long id){
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hide Method


def researchProjectInstance = getResearchProjectInstance(id)

Expand All @@ -44,7 +59,7 @@ class ResearchProjectController {
[researchProjectInstance: researchProjectInstance]
}

def getResearchProjectInstance(Long id){
private def getResearchProjectInstance(Long id){
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hide Method

def researchProjectInstance = ResearchProject.get(id)

if (!researchProjectInstance) {
Expand Down Expand Up @@ -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) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The 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
Expand Down
2 changes: 2 additions & 0 deletions grails-app/domain/rgms/member/Member.groovy
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

Expand All @@ -17,6 +18,7 @@ class Member {
Boolean active
String access_token
String facebook_id
User user
Copy link
Contributor Author

Choose a reason for hiding this comment

The 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]
Expand Down
2 changes: 1 addition & 1 deletion grails-app/i18n/messages_pt_BR.properties
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ default.article.imported.message = As article não existentes foram importadas c
default.article.checkVersion.message = Um outro usuário atualizou este orientation enquanto você estava editando

default.reseachproject.label = Grupo de Pesquisa

default.researchproject.myProjects = Meus Projetos de Pesquisa

conferencia.title.label=Título
conferencia.author.label=Autor
Expand Down
Loading