ProfilesModel.java
Go to the documentation of this file.
00001 /*
00002  *      Copyright (C) 2005-2013 Team XBMC
00003  *      http://xbmc.org
00004  *
00005  *  This Program is free software; you can redistribute it and/or modify
00006  *  it under the terms of the GNU General Public License as published by
00007  *  the Free Software Foundation; either version 2, or (at your option)
00008  *  any later version.
00009  *
00010  *  This Program is distributed in the hope that it will be useful,
00011  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00013  *  GNU General Public License for more details.
00014  *
00015  *  You should have received a copy of the GNU General Public License
00016  *  along with XBMC Remote; see the file license.  If not, write to
00017  *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
00018  *  http://www.gnu.org/copyleft/gpl.html
00019  *
00020  */
00021 package org.xbmc.android.jsonrpc.api.model;
00022 
00023 import android.os.Parcel;
00024 import android.os.Parcelable;
00025 import java.util.ArrayList;
00026 import java.util.Arrays;
00027 import java.util.HashSet;
00028 import java.util.List;
00029 import java.util.Set;
00030 import org.codehaus.jackson.JsonNode;
00031 import org.codehaus.jackson.node.ArrayNode;
00032 import org.codehaus.jackson.node.ObjectNode;
00033 import org.xbmc.android.jsonrpc.api.AbstractModel;
00034 
00035 public final class ProfilesModel {
00036 
00043         public static class ProfileDetail extends ItemModel.BaseDetail {
00044                 public final static String API_TYPE = "Profiles.Details.Profile";
00045 
00046                 // field names
00047                 public static final String LOCKMODE = "lockmode";
00048                 public static final String THUMBNAIL = "thumbnail";
00049 
00050                 // class members
00051                 public final Integer lockmode;
00052                 public final String thumbnail;
00053 
00058                 public ProfileDetail(JsonNode node) {
00059                         super(node);
00060                         lockmode = parseInt(node, LOCKMODE);
00061                         thumbnail = parseString(node, THUMBNAIL);
00062                 }
00063 
00064                 @Override
00065                 public JsonNode toJsonNode() {
00066                         final ObjectNode node = (ObjectNode)super.toJsonNode();
00067                         node.put(LOCKMODE, lockmode);
00068                         node.put(THUMBNAIL, thumbnail);
00069                         return node;
00070                 }
00071 
00077                 static List<ProfileDetail> getProfilesModelProfileDetailList(JsonNode node, String key) {
00078                         if (node.has(key)) {
00079                                 final ArrayNode a = (ArrayNode)node.get(key);
00080                                 final List<ProfileDetail> l = new ArrayList<ProfileDetail>(a.size());
00081                                 for (int i = 0; i < a.size(); i++) {
00082                                         l.add(new ProfileDetail((JsonNode)a.get(i)));
00083                                 }
00084                                 return l;
00085                         }
00086                         return new ArrayList<ProfileDetail>(0);
00087                 }
00088 
00094                 @Override
00095                 public void writeToParcel(Parcel parcel, int flags) {
00096                         super.writeToParcel(parcel, flags);
00097                         parcel.writeValue(lockmode);
00098                         parcel.writeValue(thumbnail);
00099                 }
00100 
00104                 protected ProfileDetail(Parcel parcel) {
00105                         super(parcel);
00106                         lockmode = parcel.readInt();
00107                         thumbnail = parcel.readString();
00108                 }
00109 
00113                 public static final Parcelable.Creator<ProfileDetail> CREATOR = new Parcelable.Creator<ProfileDetail>() {
00114                         @Override
00115                         public ProfileDetail createFromParcel(Parcel parcel) {
00116                                 return new ProfileDetail(parcel);
00117                         }
00118                         @Override
00119                         public ProfileDetail[] newArray(int n) {
00120                                 return new ProfileDetail[n];
00121                         }
00122                 };
00123 
00124                 @Override
00125                 public int describeContents() {
00126                         return 0;
00127                 }
00128         }
00129 
00136         public static class Password extends AbstractModel {
00137                 public final static String API_TYPE = "Profiles.Password";
00138 
00139                 // field names
00140                 public static final String ENCRYPTION = "encryption";
00141                 public static final String VALUE = "value";
00142 
00143                 // class members
00144                 public final String encryption;
00145                 public final String value;
00146 
00151                 public Password(String encryption, String value) {
00152                         this.encryption = encryption;
00153                         this.value = value;
00154                 }
00155 
00156                 @Override
00157                 public JsonNode toJsonNode() {
00158                         final ObjectNode node = OM.createObjectNode();
00159                         node.put(ENCRYPTION, encryption); // enum
00160                         node.put(VALUE, value);
00161                         return node;
00162                 }
00163 
00169                 @Override
00170                 public void writeToParcel(Parcel parcel, int flags) {
00171                         parcel.writeValue(encryption); // enum
00172                         parcel.writeValue(value);
00173                 }
00174 
00178                 protected Password(Parcel parcel) {
00179                         encryption = parcel.readString(); // enum
00180                         value = parcel.readString();
00181                 }
00182 
00186                 public static final Parcelable.Creator<Password> CREATOR = new Parcelable.Creator<Password>() {
00187                         @Override
00188                         public Password createFromParcel(Parcel parcel) {
00189                                 return new Password(parcel);
00190                         }
00191                         @Override
00192                         public Password[] newArray(int n) {
00193                                 return new Password[n];
00194                         }
00195                 };
00196 
00197                 @Override
00198                 public int describeContents() {
00199                         return 0;
00200                 }
00201 
00205                 public interface Encryption {
00206 
00207                         public final String NONE = "none";
00208                         public final String MD5 = "md5";
00209 
00210                         public final static Set<String> values = new HashSet<String>(Arrays.asList(NONE, MD5));
00211                 }
00212         }
00213 
00217         public interface ProfileFields {
00218 
00219                 public final String THUMBNAIL = "thumbnail";
00220                 public final String LOCKMODE = "lockmode";
00221 
00222                 public final static Set<String> values = new HashSet<String>(Arrays.asList(THUMBNAIL, LOCKMODE));
00223         }
00224 }


smarthome_media_kodi_driver
Author(s): Mickael Gaillard , Erwan Le Huitouze
autogenerated on Thu Jun 6 2019 21:03:49