Skip to content

Instantly share code, notes, and snippets.

@brikis98
Created August 9, 2011 00:38
Show Gist options
  • Select an option

  • Save brikis98/1133152 to your computer and use it in GitHub Desktop.

Select an option

Save brikis98/1133152 to your computer and use it in GitHub Desktop.
Frontier Content Model Example
/**
*
* 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);
}
/**
*
* 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;
}
/**
*
* 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);
}
});
}
}
@brikis98
Copy link
Author

brikis98 commented Aug 9, 2011

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment