Created
August 9, 2011 00:38
-
-
Save brikis98/1133152 to your computer and use it in GitHub Desktop.
Frontier Content Model Example
This file contains hidden or 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
| /** | |
| * | |
| * A simplified example of a Frontier Content Model that defines some basic data for a company | |
| * | |
| */ | |
| public interface CompanyContentModel extends ContentModelPrototype | |
| { | |
| Integer getCompanyId(); | |
| void setCompanyId(Integer companyId); | |
| String getLocation(); | |
| void setLocation(String location); | |
| String getWebsite(); | |
| void setWebsite(String website); | |
| } |
This file contains hidden or 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
| /** | |
| * | |
| * A simplified example of a Frontier Content Service to read & write company data | |
| * | |
| */ | |
| public interface CompanyContentService extends ContentService | |
| { | |
| @ReadMethod | |
| void getCompanyInfo(CompanyCriteria criteria, CompanyContentModel company) throws InternalException; | |
| @WriteMethod(type = WriteMethodType.CREATE) | |
| void createCompanyInfo(CompanyContentModel in, CompanyContentModel out) throws InternalException; | |
| } |
This file contains hidden or 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
| /** | |
| * | |
| * Example implementation of CompanyContentService showing the write method | |
| * | |
| */ | |
| public class CompanyContentServiceImpl implements CompanyContentService | |
| { | |
| void createCompanyInfo(final CompanyContentModel in, CompanyContentModel out) throws InternalException | |
| { | |
| _voldemortClient.applyUpdate(new UpdateAction<Integer, Map<String,String>>() | |
| { | |
| @Override | |
| public void update(StoreClient<Integer, Map<String,String>> store) | |
| { | |
| Map<String, String> params = new HashMap<String, String>(); | |
| params.put("location", in.getLocation()); | |
| params.put("website", in.getWebsite()); | |
| store.put(in.getCompanyId(), params); | |
| } | |
| }); | |
| } | |
| } |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
See A LinkedIn app end to end: JRuby, Frontier, and Voldemort for more info.