Created
March 2, 2012 02:36
-
-
Save leadVisionary/1955115 to your computer and use it in GitHub Desktop.
Conflict arises from refactoring
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.visionarysoftwaresolutions | |
//Refactored | |
class DatastoreService { | |
def parseService | |
public Zapper createUser(String email){ | |
parseService.createUser(email) | |
} | |
public ZapCard createCard(Zapper owner, String name, String phoneNumber){ | |
parseService.createCard(owner,name,phoneNumber) | |
} | |
void collectRemoteData() { | |
parseService.retrieveUsersFromParse() | |
parseService.retrieveCardsFromParse() | |
} | |
void exchangeCards(Zapper sender, ZapCard zappCard, Zapper recipient){ | |
parseService.exchange(sender, zappCard, recipient) | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.visionarysoftwaresolutions | |
abstract class ParseEntity { | |
String parseObjectId | |
static constraints = { | |
parseObjectId blank : false, unique : true | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.visionarysoftwaresolutions | |
class ZapCard extends ParseEntity { | |
String name | |
String phoneNumber | |
static belongsTo = [ owner : Zapper ] | |
static constraints = { | |
name blank:false, unique:true | |
phoneNumber matches:/^[01]?\s*[\(\.-]?(\d{3})[\)\.-]?\s*(\d{3})[\.-](\d{4})$/ | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.visionarysoftwaresolutions | |
class Zapper extends ParseEntity { | |
String email | |
static hasMany = [ cards: ZapCard ] | |
static constraints = { | |
email blank : false, unique : true, email : true | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment