From 4d399c6cd66f6c2822f9a29ea0c352808a90df72 Mon Sep 17 00:00:00 2001 From: Mattias Mirhagen Date: Fri, 15 Jan 2010 13:57:22 +0100 Subject: [PATCH] Deleted domain and added BuildConfig with path to domain plugin --- qanban-domain-plugin/plugin.xml | 5 +- qanban/application.properties | 2 +- qanban/grails-app/conf/BuildConfig.groovy | 1 + .../domain/se/qbranch/qanban/Board.groovy | 35 ------- .../se/qbranch/qanban/BoardEvent.groovy | 43 -------- .../se/qbranch/qanban/BoardEventCreate.groovy | 49 ---------- .../domain/se/qbranch/qanban/Card.groovy | 53 ---------- .../domain/se/qbranch/qanban/CardEvent.groovy | 41 -------- .../se/qbranch/qanban/CardEventCreate.groovy | 98 ------------------- .../se/qbranch/qanban/CardEventDelete.groovy | 73 -------------- .../se/qbranch/qanban/CardEventMove.groovy | 81 --------------- .../qanban/CardEventSetAssignee.groovy | 57 ----------- .../se/qbranch/qanban/CardEventUpdate.groovy | 80 --------------- .../domain/se/qbranch/qanban/Event.groovy | 80 --------------- .../domain/se/qbranch/qanban/Phase.groovy | 53 ---------- .../se/qbranch/qanban/PhaseEvent.groovy | 39 -------- .../se/qbranch/qanban/PhaseEventCreate.groovy | 82 ---------------- .../se/qbranch/qanban/PhaseEventDelete.groovy | 77 --------------- .../se/qbranch/qanban/PhaseEventMove.groovy | 54 ---------- .../se/qbranch/qanban/PhaseEventUpdate.groovy | 76 -------------- .../domain/se/qbranch/qanban/Role.groovy | 41 -------- .../domain/se/qbranch/qanban/User.groovy | 62 ------------ .../domain/se/qbranch/qanban/UserEvent.groovy | 38 ------- .../se/qbranch/qanban/UserEventCreate.groovy | 80 --------------- 24 files changed, 6 insertions(+), 1294 deletions(-) create mode 100644 qanban/grails-app/conf/BuildConfig.groovy delete mode 100644 qanban/grails-app/domain/se/qbranch/qanban/Board.groovy delete mode 100644 qanban/grails-app/domain/se/qbranch/qanban/BoardEvent.groovy delete mode 100644 qanban/grails-app/domain/se/qbranch/qanban/BoardEventCreate.groovy delete mode 100644 qanban/grails-app/domain/se/qbranch/qanban/Card.groovy delete mode 100644 qanban/grails-app/domain/se/qbranch/qanban/CardEvent.groovy delete mode 100644 qanban/grails-app/domain/se/qbranch/qanban/CardEventCreate.groovy delete mode 100644 qanban/grails-app/domain/se/qbranch/qanban/CardEventDelete.groovy delete mode 100644 qanban/grails-app/domain/se/qbranch/qanban/CardEventMove.groovy delete mode 100644 qanban/grails-app/domain/se/qbranch/qanban/CardEventSetAssignee.groovy delete mode 100644 qanban/grails-app/domain/se/qbranch/qanban/CardEventUpdate.groovy delete mode 100644 qanban/grails-app/domain/se/qbranch/qanban/Event.groovy delete mode 100644 qanban/grails-app/domain/se/qbranch/qanban/Phase.groovy delete mode 100644 qanban/grails-app/domain/se/qbranch/qanban/PhaseEvent.groovy delete mode 100644 qanban/grails-app/domain/se/qbranch/qanban/PhaseEventCreate.groovy delete mode 100644 qanban/grails-app/domain/se/qbranch/qanban/PhaseEventDelete.groovy delete mode 100644 qanban/grails-app/domain/se/qbranch/qanban/PhaseEventMove.groovy delete mode 100644 qanban/grails-app/domain/se/qbranch/qanban/PhaseEventUpdate.groovy delete mode 100644 qanban/grails-app/domain/se/qbranch/qanban/Role.groovy delete mode 100644 qanban/grails-app/domain/se/qbranch/qanban/User.groovy delete mode 100644 qanban/grails-app/domain/se/qbranch/qanban/UserEvent.groovy delete mode 100644 qanban/grails-app/domain/se/qbranch/qanban/UserEventCreate.groovy diff --git a/qanban-domain-plugin/plugin.xml b/qanban-domain-plugin/plugin.xml index 24f330f..074b70c 100644 --- a/qanban-domain-plugin/plugin.xml +++ b/qanban-domain-plugin/plugin.xml @@ -32,5 +32,8 @@ This plugin hold the domain model for the Qanban application UrlMappings DataSource - + + + + \ No newline at end of file diff --git a/qanban/application.properties b/qanban/application.properties index aa1d838..7a1b6b2 100644 --- a/qanban/application.properties +++ b/qanban/application.properties @@ -1,5 +1,5 @@ #utf-8 -#Thu Jan 14 10:30:39 CET 2010 +#Fri Jan 15 11:38:29 CET 2010 plugins.acegi=0.5.2 app.version=0.1 plugins.jquery=1.3.2.4 diff --git a/qanban/grails-app/conf/BuildConfig.groovy b/qanban/grails-app/conf/BuildConfig.groovy new file mode 100644 index 0000000..c9194a1 --- /dev/null +++ b/qanban/grails-app/conf/BuildConfig.groovy @@ -0,0 +1 @@ +grails.plugin.location.'qanban-domain' = "../qanban-domain-plugin" diff --git a/qanban/grails-app/domain/se/qbranch/qanban/Board.groovy b/qanban/grails-app/domain/se/qbranch/qanban/Board.groovy deleted file mode 100644 index d40c59b..0000000 --- a/qanban/grails-app/domain/se/qbranch/qanban/Board.groovy +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright 2009 Qbranch AB - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package se.qbranch.qanban - -class Board { - - static constraints = { - domainId( unique: true, blank: false ) - title( unique: true, blank: false ) - } - - static hasMany = [phases:Phase] - List phases = [] - - String domainId - String title - - Date dateCreated - Date lastUpdated - -} diff --git a/qanban/grails-app/domain/se/qbranch/qanban/BoardEvent.groovy b/qanban/grails-app/domain/se/qbranch/qanban/BoardEvent.groovy deleted file mode 100644 index 51f40e1..0000000 --- a/qanban/grails-app/domain/se/qbranch/qanban/BoardEvent.groovy +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright 2009 Qbranch AB - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package se.qbranch.qanban - -class BoardEvent extends Event{ - - static constraints = { - } - - transient public String checkCurrentTitle() { - if( domainId ){ - def board = Board.findByDomainId(domainId) - if (board){ - return board.title - }else{ - return 'The board does not exist' - } - } - else return "This should not be a valid output" - } - - public boolean doesDomainExist(){ - return Board.findByDomainId(domainId) != null - } - - public List getItems() { - return [dateCreated, user, getBoard().title] - } - -} diff --git a/qanban/grails-app/domain/se/qbranch/qanban/BoardEventCreate.groovy b/qanban/grails-app/domain/se/qbranch/qanban/BoardEventCreate.groovy deleted file mode 100644 index 29f8042..0000000 --- a/qanban/grails-app/domain/se/qbranch/qanban/BoardEventCreate.groovy +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright 2009 Qbranch AB - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package se.qbranch.qanban - -class BoardEventCreate extends BoardEvent{ - - static constraints = { - title ( nullable: false, blank: false ) - } - - static transients = ['board','items'] - - Board board - String title - - public Board getBoard(){ - if( !board && domainId ) - board = Board.findByDomainId(domainId) - return board - } - - def beforeInsert = { - generateDomainId('board','create') - setEventCreator(user) - } - - def process(){ - board = new Board() - board.domainId = domainId - board.title = title - board.save() - } - - -} diff --git a/qanban/grails-app/domain/se/qbranch/qanban/Card.groovy b/qanban/grails-app/domain/se/qbranch/qanban/Card.groovy deleted file mode 100644 index eeac91e..0000000 --- a/qanban/grails-app/domain/se/qbranch/qanban/Card.groovy +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright 2009 Qbranch AB - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package se.qbranch.qanban - -class Card { - - static constraints = { - title(blank:false, length:1..50) - description( blank: true, nullable: true) - caseNumber( blank: false ) - assignee(nullable: true) - phase() - domainId( unique: true, blank: false ) - } - - - static mapping = { - columns { - description type:'text' - } - } - - - String domainId - String title - String description - String caseNumber - - Date dateCreated - Date lastUpdated - - User assignee - Phase phase - - public String toString() { - return "$title" - } - -} diff --git a/qanban/grails-app/domain/se/qbranch/qanban/CardEvent.groovy b/qanban/grails-app/domain/se/qbranch/qanban/CardEvent.groovy deleted file mode 100644 index f0edba1..0000000 --- a/qanban/grails-app/domain/se/qbranch/qanban/CardEvent.groovy +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright 2009 Qbranch AB - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package se.qbranch.qanban - -class CardEvent extends Event { - - static constraints = { - // TODO: Check if there is a way to let this override the inherited contraint? - // user(nullable: false) - } - - transient public String checkCurrentTitle() { - if( domainId ){ - def card = Card.findByDomainId(domainId) - if (card){ - return card.title - }else{ - return CardEventDelete.findByDomainId(domainId).title - } - } - else return "This should not be a valid output" - } - - transient boolean doesDomainExist(){ - return Card.findByDomainId(domainId) != null - } -} diff --git a/qanban/grails-app/domain/se/qbranch/qanban/CardEventCreate.groovy b/qanban/grails-app/domain/se/qbranch/qanban/CardEventCreate.groovy deleted file mode 100644 index e72554d..0000000 --- a/qanban/grails-app/domain/se/qbranch/qanban/CardEventCreate.groovy +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright 2009 Qbranch AB - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package se.qbranch.qanban - - -class CardEventCreate extends CardEvent { - - static constraints = { - assignee ( nullable : true ) - title( blank: false, length: 1..50 ) - description(blank: true, nullable: true) - phaseDomainId( nullable: false, blank: false ) - caseNumber( blank: false ) - } - - static mapping = { - columns { - description type:'text' - } - } - - static transients = ['card','phase','board','items'] - - Card card - - String title - String description - String caseNumber - String phaseDomainId - - //TODO: Change to checksum connections? - User assignee - - public List getItems() { - return [dateCreated, user, getCard().title] - } - - public Phase getPhase() { - def phase - - if( phaseDomainId ){ - phase = Phase.findByDomainId(phaseDomainId) - } - return phase - } - - public Card getCard(){ - if( !card && domainId ){ - card = Card.findByDomainId(domainId) - if(!card) { - card = CardEventDelete.findByDomainId(domainId).card - } - } - return card - } - - //TODO: Cleanup, check lazy settings. - public Board getBoard(){ - Phase.findByDomainId(phaseDomainId).board - } - - def beforeInsert = { - generateDomainId(title, caseNumber) - setEventCreator(user) - } - - def process(){ - def phase = getPhase() - card = new Card() - card.domainId = domainId - card.title = title - card.phase = phase - card.description = description - card.caseNumber = caseNumber - card.assignee = assignee - phase.addToCards(card) - card.save() - } - - - String toString() { - return "$dateCreated: $user created the card" - } -} diff --git a/qanban/grails-app/domain/se/qbranch/qanban/CardEventDelete.groovy b/qanban/grails-app/domain/se/qbranch/qanban/CardEventDelete.groovy deleted file mode 100644 index 7dbf061..0000000 --- a/qanban/grails-app/domain/se/qbranch/qanban/CardEventDelete.groovy +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright 2009 Qbranch AB - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package se.qbranch.qanban - -class CardEventDelete extends CardEvent { - - static constraints = { - assignee ( nullable : true ) - title( nullable: true ) - description( nullable: true) - phaseDomainId( nullable: true ) - phasePos ( nullable: true ) - caseNumber( nullable: true ) - } - - static mapping = { - columns { - description type:'text' - } - } - - static transients = ['card','items'] - - Card card - - String title - String description - String caseNumber - String phaseDomainId - Integer phasePos - User assignee - - public List getItems() { - return [getCard().title] - } - - public Card getCard(){ - if(!card && domainId) { - card = new Card(title: title, description: description, caseNumber: caseNumber, phase: Phase.findByDomainId(phaseDomainId)) - } - return card - } - - transient beforeInsert = { - domainId = card.domainId - title = card.title - description = card.description - caseNumber = card.caseNumber - phaseDomainId = card.phase.domainId - phasePos = card.phase.board.phases.indexOf(card) - assignee = card.assignee - setEventCreator(user) - } - - transient process(){ - card.phase.cards.remove(card) - card.delete(flush:true) - } -} diff --git a/qanban/grails-app/domain/se/qbranch/qanban/CardEventMove.groovy b/qanban/grails-app/domain/se/qbranch/qanban/CardEventMove.groovy deleted file mode 100644 index 9598210..0000000 --- a/qanban/grails-app/domain/se/qbranch/qanban/CardEventMove.groovy +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright 2009 Qbranch AB - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package se.qbranch.qanban - -class CardEventMove extends CardEvent { - - static constraints = { - phaseDomainId ( nullable: true, blank: false ) - newCardIndex ( nullable: false, min: 0) - } - - static transients = ['card','newPhase','items'] - Card card - Phase newPhase - - String phaseDomainId - Integer newCardIndex - - public List getItems() { - return [dateCreated, user, getCard().title, getNewPhase().title] - } - - public Card getCard(){ - if( !card && domainId ){ - card = Card.findByDomainId(domainId) - if(!card) { - card = CardEventDelete.findByDomainId(domainId).card - } - } - return card - } - - public Phase getNewPhase(){ - if( !newPhase && phaseDomainId ){ - newPhase = Phase.findByDomainId(phaseDomainId) - if(!newPhase) { - newPhase = PhaseEventDelete.findByDomainId(phaseDomainId).phase - } - } - return newPhase - } - - - transient beforeInsert = { - domainId = card.domainId - phaseDomainId = newPhase.domainId - setEventCreator(user) - } - - transient process = { - - card.phase.cards.remove(card) - newPhase.cards.add(newCardIndex, card) - card.phase = newPhase - card.lastUpdated = new Date() - card.save(flush:true) - - } - - String toString(){ - def phase = Phase.findByDomainId(phaseDomainId) - if (phase) - return "$dateCreated: $user moved the card to $phase.title" - else - return "$dateCreated: $user moved the card to a deleted phase" - } -} \ No newline at end of file diff --git a/qanban/grails-app/domain/se/qbranch/qanban/CardEventSetAssignee.groovy b/qanban/grails-app/domain/se/qbranch/qanban/CardEventSetAssignee.groovy deleted file mode 100644 index ce58620..0000000 --- a/qanban/grails-app/domain/se/qbranch/qanban/CardEventSetAssignee.groovy +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright 2009 Qbranch AB - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package se.qbranch.qanban - -class CardEventSetAssignee extends CardEvent { - - static constraints = { - newAssignee ( nullable: true ) - } - - static transients = ['card','items'] - Card card - - User newAssignee - - public List getItems() { - return [dateCreated, user, newAssignee] - } - - public Card getCard(){ - if( !card && domainId ){ - card = Card.findByDomainId(domainId) - if(!card) { - card = CardEventDelete.findByDomainId(domainId).card - } - } - return card - } - - transient beforeInsert = { - domainId = card.domainId - setEventCreator(user) - } - - transient process(){ - card.assignee = newAssignee - card.save() - } - - String toString(){ - return "$dateCreated: $user set the assignee to $newAssignee" - } -} diff --git a/qanban/grails-app/domain/se/qbranch/qanban/CardEventUpdate.groovy b/qanban/grails-app/domain/se/qbranch/qanban/CardEventUpdate.groovy deleted file mode 100644 index 7089245..0000000 --- a/qanban/grails-app/domain/se/qbranch/qanban/CardEventUpdate.groovy +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright 2009 Qbranch AB - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package se.qbranch.qanban - -class CardEventUpdate extends CardEvent { - - // TODO: Validera så att eventen inte sparas om inget värde har ändrats - - static constraints = { - title( blank: false, length: 1..50) - description( blank: true, nullable: true ) - caseNumber( blank: false) - } - - - static mapping = { - columns { - description type:'text' - } - } - - static transients = ['card','items'] - Card card - - String title - String description - String caseNumber - - public List getItems() { - return [dateCreated, user, getCard().title] - } - - public Card getCard(){ - if( !card && domainId ){ - card = Card.findByDomainId(domainId) - if(!card) { - card = CardEventDelete.findByDomainId(domainId).card - } - } - return card - } - - public void setCard(card){ - this.card = card - title = card.title - description = card.description - caseNumber = card.caseNumber - } - - transient beforeInsert = { - domainId = card.domainId - setEventCreator(user) - } - - transient process(){ - - card.title = title - card.description = description - card.caseNumber = caseNumber - card.save() - } - - String toString(){ - return "$dateCreated: $user updated the card info" - } -} diff --git a/qanban/grails-app/domain/se/qbranch/qanban/Event.groovy b/qanban/grails-app/domain/se/qbranch/qanban/Event.groovy deleted file mode 100644 index b6ea0d5..0000000 --- a/qanban/grails-app/domain/se/qbranch/qanban/Event.groovy +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright 2009 Qbranch AB - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package se.qbranch.qanban - -import org.codehaus.groovy.grails.plugins.codecs.MD5Codec as Codec - -class Event implements Comparable { - - static constraints = { - domainId( nullable:true, blank: false ) - userDomainId(nullable: true) - user(nullable: true) - } - - static transients = ['items','user','eventCreator'] - User user - - Date dateCreated - String domainId - String userDomainId - - public List getItems() { - return [] - } - - public void setEventCreator(user){ - userDomainId = user.domainId - } - - public User getUser(){ - if( !user && userDomainId ){ - return user = User.findByDomainId(userDomainId) - } - return user - } - - def generateDomainId( Object[] notNullableProperties ){ - domainId = Codec.encode( new Date().time + notNullableProperties.toString() ) - } - - int compareTo(Object o) { - if (o instanceof Event) { - Event event = (Event) o - final int BEFORE = -1; - final int EQUAL = 0; - final int AFTER = 1; - - if(this.dateCreated < event.dateCreated) return AFTER - if(this.dateCreated > event.dateCreated) return BEFORE - - return EQUAL - } - - } - - boolean equals(Object o) { - if(o instanceof Event) { - Event event = (Event) o - if(this.id == event.id) - return true - } - return false - } - - -} diff --git a/qanban/grails-app/domain/se/qbranch/qanban/Phase.groovy b/qanban/grails-app/domain/se/qbranch/qanban/Phase.groovy deleted file mode 100644 index b6c2b5c..0000000 --- a/qanban/grails-app/domain/se/qbranch/qanban/Phase.groovy +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright 2009 Qbranch AB - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package se.qbranch.qanban - -class Phase { - - static constraints = { - title(nullable: false, blank: false) - cardLimit(nullable: false, min: 0, validator:{ limit, phaseInstance -> - if( limit != 0 && limit < phaseInstance.cards.size() ) - return ['phase.cardLimit.lessThanCardsSize', limit] - }) - domainId( nullable: false, unique: true, blank: false) - } - - static hasMany = [cards:Card] - - String title - Board board - List cards = [] - Integer cardLimit - String domainId - - Date dateCreated - Date lastUpdated - - boolean equals(Object o) { - if(o instanceof Phase) { - Phase p = (Phase) o - if(this.id == p.id) - return true - } - return false - } - - public String toString() { - return "$title" - } -} \ No newline at end of file diff --git a/qanban/grails-app/domain/se/qbranch/qanban/PhaseEvent.groovy b/qanban/grails-app/domain/se/qbranch/qanban/PhaseEvent.groovy deleted file mode 100644 index 8e6bf99..0000000 --- a/qanban/grails-app/domain/se/qbranch/qanban/PhaseEvent.groovy +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright 2009 Qbranch AB - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package se.qbranch.qanban - -class PhaseEvent extends Event { - - static constraints = { - } - - transient public String checkCurrentTitle() { - if( domainId ){ - def phase = Phase.findByDomainId(domainId) - if (phase){ - return phase.title - }else{ - return PhaseEventDelete.findByDomainId(domainId).title - } - } - else return "This should not be a valid output" - } - - public boolean doesDomainExist(){ - return Phase.findByDomainId(domainId) != null - } -} diff --git a/qanban/grails-app/domain/se/qbranch/qanban/PhaseEventCreate.groovy b/qanban/grails-app/domain/se/qbranch/qanban/PhaseEventCreate.groovy deleted file mode 100644 index fad06cf..0000000 --- a/qanban/grails-app/domain/se/qbranch/qanban/PhaseEventCreate.groovy +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright 2009 Qbranch AB - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package se.qbranch.qanban - -import org.codehaus.groovy.grails.plugins.codecs.MD5Codec - -class PhaseEventCreate extends PhaseEvent { - - static constraints = { - cardLimit ( nullable: false, min : 0 ) - phasePos ( nullable: false ) - title(nullable: false, blank: false) - boardDomainId ( nullable: true ) - } - - static transients = ['board','phase','items'] - Phase phase - Board board - - String title - Integer cardLimit - Integer phasePos - String boardDomainId - - public List getItems() { - return [getPhase().title] - } - - public Phase getPhase(){ - if( !phase && domainId ){ - phase = Phase.findByDomainId(domainId) - if(!phase) { - phase = PhaseEventDelete.findByDomainId(domainId).phase - } - } - return phase - } - - public Board getBoard(){ - if( !board && boardDomainId){ - board = Board.findByDomainId(boardDomainId) - }else if( board )( - board = Board.get(board.id) - ) - return board - } - - transient beforeInsert = { - generateDomainId(title, board ) - boardDomainId = board.domainId - setEventCreator(user) - } - - transient process = { - - phase = new Phase( - title: title, - board: board, - cardLimit: cardLimit, - domainId: domainId - ) - // Board.get() because GORM doesn't let us persist transient values - Board.get(board.id).phases.add(phasePos, phase) - - phase.save() - - } -} diff --git a/qanban/grails-app/domain/se/qbranch/qanban/PhaseEventDelete.groovy b/qanban/grails-app/domain/se/qbranch/qanban/PhaseEventDelete.groovy deleted file mode 100644 index c790c60..0000000 --- a/qanban/grails-app/domain/se/qbranch/qanban/PhaseEventDelete.groovy +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright 2009 Qbranch AB - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package se.qbranch.qanban - -class PhaseEventDelete extends PhaseEvent { - - static constraints = { - cardLimit ( nullable: true ) - title ( nullable: true ) - boardDomainId ( nullable: true ) - phasePos ( nullable: true ) - } - - static transients = ['phase','items','board'] - - Phase phase - Board board - - String title - Integer cardLimit - Integer phasePos - String boardDomainId - - public List getItems() { - return [getPhase().title] - } - - public Phase getPhase(){ - if( !phase && domainId ){ - phase = new Phase(title: title, board: board, cardLimit: cardLimit); - } - return phase - } - - public void setPhase(phase){ - this.phase = phase - this.board = phase.board - } - - public Board getBoard(){ - if( !board && boardDomainId ){ - board = Board.findByDomainId(boardDomainId) - } - return board - } - - transient beforeInsert = { - domainId = phase.domainId - title = phase.title - boardDomainId = phase.board.domainId - cardLimit = phase.cardLimit - phasePos = Board.get(board.id).phases.indexOf(phase) - setEventCreator(user) - } - - transient process(){ - //board.phases.remove(phase) - board.removeFromPhases(phase) - phase.delete() - - - } -} diff --git a/qanban/grails-app/domain/se/qbranch/qanban/PhaseEventMove.groovy b/qanban/grails-app/domain/se/qbranch/qanban/PhaseEventMove.groovy deleted file mode 100644 index 41c63d8..0000000 --- a/qanban/grails-app/domain/se/qbranch/qanban/PhaseEventMove.groovy +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright 2009 Qbranch AB - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package se.qbranch.qanban - -class PhaseEventMove extends PhaseEvent { - - static constraints = { - phasePos (min: 0, nullable: false, validator:{ val, obj -> - - return ( val < obj.phase.board.phases.size() ) - - }) - } - - static transients = ['phase'] - Phase phase - - Integer phasePos - - public Phase getPhase(){ - if( !phase && domainId ){ - phase = Phase.findByDomainId(domainId) - if(!phase) { - phase = PhaseEventDelete.findByDomainId(domainId).phase - } - } - return phase - } - - transient beforeInsert = { - domainId = phase.domainId - setEventCreator(user) - } - - transient process(){ - phase.board.phases.remove(phase) - phase.board.phases.add(phasePos, phase) - phase.board.save() - } -} diff --git a/qanban/grails-app/domain/se/qbranch/qanban/PhaseEventUpdate.groovy b/qanban/grails-app/domain/se/qbranch/qanban/PhaseEventUpdate.groovy deleted file mode 100644 index 0c76b6c..0000000 --- a/qanban/grails-app/domain/se/qbranch/qanban/PhaseEventUpdate.groovy +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright 2009 Qbranch AB - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package se.qbranch.qanban - -class PhaseEventUpdate extends PhaseEvent { - - // TODO: Validera så att eventen inte sparas om inget värde har ändrats - - static constraints = { - title ( nullable: false, blank: false ) - cardLimit ( nullable: false, min : 0 ) - } - - static transients = ['phase','board','items'] - - Phase phase - - String title - Integer cardLimit - - public List getItems() { - return [getPhase().title] - } - - public Phase getPhase(){ - if( !phase && domainId ){ - phase = Phase.findByDomainId(domainId) - if(!phase) { - phase = PhaseEventDelete.findByDomainId(domainId).phase - } - } - return phase - } - - public void setPhase(phase){ - this.phase = phase - } - - //TODO: Cleanup, check lazy settings. - public Board getBoard(){ - Phase.get(phase.id).board - } - - transient beforeInsert = { - domainId = Phase.get(phase.id).domainId - setEventCreator(user) - } - - transient void populateFromPhase(){ - if( phase ){ - title = phase.title - cardLimit = phase.cardLimit - } - } - transient process( ) { - - phase.title = title - phase.cardLimit = cardLimit - phase.save() - - } -} diff --git a/qanban/grails-app/domain/se/qbranch/qanban/Role.groovy b/qanban/grails-app/domain/se/qbranch/qanban/Role.groovy deleted file mode 100644 index e617978..0000000 --- a/qanban/grails-app/domain/se/qbranch/qanban/Role.groovy +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright 2009 Qbranch AB - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package se.qbranch.qanban - -import se.qbranch.qanban.User - -/** - * Authority domain class. - */ -class Role { - - static constraints = { - authority(blank: false, unique: true) - description() - } - - static hasMany = [people: User] - - String description - /** ROLE String */ - String authority - - public boolean equals(obj){ - return ( obj instanceof Role && obj.id == this.id ) - } - -} diff --git a/qanban/grails-app/domain/se/qbranch/qanban/User.groovy b/qanban/grails-app/domain/se/qbranch/qanban/User.groovy deleted file mode 100644 index 71eb486..0000000 --- a/qanban/grails-app/domain/se/qbranch/qanban/User.groovy +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright 2009 Qbranch AB - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package se.qbranch.qanban - -import se.qbranch.qanban.Role - -/** - * User domain class. - */ -class User { - - static constraints = { - username(blank: false, unique: true) - userRealName(blank: false) - passwd( nullable: false, blank: false, validator:{ val, obj -> - if( val != obj.passwdRepeat ){ - return ['userEventCreate.passwd.notEqualRepeat'] - } - }) - enabled() - domainId( nullable: false, blank: false, unique: true) - } - - static transients = ['pass','passwdRepeat'] - static hasMany = [authorities: Role] - static belongsTo = Role - - String domainId - String username - String userRealName - /** MD5 Password */ - String passwd - boolean enabled - - String email - boolean emailShow - - String description = '' - - /** plain password to create a MD5 password */ - String pass = '[secret]' - String passwdRepeat - - - String toString(){ - return userRealName - } -} diff --git a/qanban/grails-app/domain/se/qbranch/qanban/UserEvent.groovy b/qanban/grails-app/domain/se/qbranch/qanban/UserEvent.groovy deleted file mode 100644 index d7dc67a..0000000 --- a/qanban/grails-app/domain/se/qbranch/qanban/UserEvent.groovy +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright 2009 Qbranch AB - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package se.qbranch.qanban - -class UserEvent extends Event{ - - static constraints = { - } - - transient public String checkCurrentTitle() { - if( domainId ){ - def user = User.findByDomainId(domainId) - if (user){ - return user.userRealName - }else{ - return 'The user does not exist' - } - } - else return "This should not be a valid output" - } - - public boolean doesDomainExist(){ - return User.findByDomainId(domainId) != null - } -} diff --git a/qanban/grails-app/domain/se/qbranch/qanban/UserEventCreate.groovy b/qanban/grails-app/domain/se/qbranch/qanban/UserEventCreate.groovy deleted file mode 100644 index f55fa8f..0000000 --- a/qanban/grails-app/domain/se/qbranch/qanban/UserEventCreate.groovy +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright 2009 Qbranch AB - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package se.qbranch.qanban - -class UserEventCreate extends UserEvent { - - def authenticateService - - static constraints = { - username(blank: false, unique: true) - userRealName(blank: false) - email(nullable: false, blank: false, email:true) - enabled( nullable: true) - emailShow( nullable: true) - passwd( nullable: false, blank: false, validator:{ val, obj -> - if( val != obj.passwdRepeat ){ - return ['userEventCreate.passwd.notEqualRepeat'] - } - }) - } - - static transients = ['list','passwdRepeat'] - - static mapping = { - columns { - description type:'text' - } - } - - String username - String userRealName - String email - boolean enabled = true - boolean emailShow = true - String description = '' - String passwd - String passwdRepeat - - public List getItems() { - return [dateCreated, user] - } - - def beforeInsert = { - generateDomainId(username,userRealName,email) - passwd = authenticateService.encodePassword(passwd) - passwdRepeat = authenticateService.encodePassword(passwdRepeat) - userDomainId = domainId // You create yourself - } - - def populateFromUser(){ - this.properties = user.properties['username','userRealName','email','enabled','emailShow','description','passwd','passwdRepeat'] - } - - def process(){ - user = new User() - user.properties = this.properties['username','userRealName','email','enabled','emailShow','description','passwd','passwdRepeat','domainId'] - - // Gives every user the admin role, this is a temporary fix until a user manager is implemented - Role.list().each{ role -> - role.addToPeople(user) - } - - - user.save() - } - -}