Skip to content

Instantly share code, notes, and snippets.

@maxme
Created December 31, 2015 08:47
Show Gist options
  • Save maxme/bc5e88b18db6f6226825 to your computer and use it in GitHub Desktop.
Save maxme/bc5e88b18db6f6226825 to your computer and use it in GitHub Desktop.
package com.wellsql.generated;
import com.yarolegovich.wellsql.core.Mapper;
import java.lang.Object;
import java.lang.Override;
import java.lang.String;
import java.util.HashMap;
import java.util.Map;
import org.wordpress.android.stores.model.SiteModel;
public final class SiteModelMapper implements Mapper<SiteModel> {
@Override
public Map<String, Object> toContentValues(SiteModel item) {
Map<String, Object> cv = new HashMap<String, Object>();
cv.put("_id", item.getId());
cv.put("SITE_ID", item.getSiteId());
cv.put("URL", item.getUrl());
cv.put("ADMIN_URL", item.getAdminUrl());
cv.put("NAME", item.getName());
cv.put("DESCRIPTION", item.getDescription());
cv.put("IS_WPCOM", item.isWPCom());
cv.put("IS_ADMIN", item.isAdmin());
cv.put("IS_FEATURED_IMAGE_SUPPORTED", item.isFeaturedImageSupported());
cv.put("USERNAME", item.getUsername());
cv.put("PASSWORD", item.getPassword());
cv.put("X_MLRPC_URL", item.getXMLRpcUrl());
cv.put("SOFTWARE_VERSION", item.getSoftwareVersion());
cv.put("IS_JETPACK", item.isJetpack());
cv.put("IS_VISIBLE", item.isVisible());
cv.put("IS_VIDEO_PRESS_SUPPORTED", item.isVideoPressSupported());
return cv;
}
@Override
public SiteModel convert(Map<String, Object> cv) {
SiteModel item = new SiteModel();
if (cv.get("_id") != null) {
item.setId((Integer) cv.get("_id"));
}
if (cv.get("SITE_ID") != null) {
item.setSiteId(((Integer) cv.get("SITE_ID")).longValue());
}
if (cv.get("URL") != null) {
item.setUrl((String) cv.get("URL"));
}
if (cv.get("ADMIN_URL") != null) {
item.setAdminUrl((String) cv.get("ADMIN_URL"));
}
if (cv.get("NAME") != null) {
item.setName((String) cv.get("NAME"));
}
if (cv.get("DESCRIPTION") != null) {
item.setDescription((String) cv.get("DESCRIPTION"));
}
if (cv.get("IS_WPCOM") != null) {
item.setIsWPCom(((Integer) cv.get("IS_WPCOM")) == 1);
}
if (cv.get("IS_ADMIN") != null) {
item.setIsAdmin(((Integer) cv.get("IS_ADMIN")) == 1);
}
if (cv.get("IS_FEATURED_IMAGE_SUPPORTED") != null) {
item.setIsFeaturedImageSupported(((Integer) cv.get("IS_FEATURED_IMAGE_SUPPORTED")) == 1);
}
if (cv.get("USERNAME") != null) {
item.setUsername((String) cv.get("USERNAME"));
}
if (cv.get("PASSWORD") != null) {
item.setPassword((String) cv.get("PASSWORD"));
}
if (cv.get("X_MLRPC_URL") != null) {
item.setXMLRpcUrl((String) cv.get("X_MLRPC_URL"));
}
if (cv.get("SOFTWARE_VERSION") != null) {
item.setSoftwareVersion((String) cv.get("SOFTWARE_VERSION"));
}
if (cv.get("IS_JETPACK") != null) {
item.setIsJetpack(((Integer) cv.get("IS_JETPACK")) == 1);
}
if (cv.get("IS_VISIBLE") != null) {
item.setIsVisible(((Integer) cv.get("IS_VISIBLE")) == 1);
}
if (cv.get("IS_VIDEO_PRESS_SUPPORTED") != null) {
item.setIsVideoPressSupported(((Integer) cv.get("IS_VIDEO_PRESS_SUPPORTED")) == 1);
}
return item;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment