| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| Account |
|
| 0.0;0 | ||||
| Account$Field |
|
| 0.0;0 |
| 1 | /* | |
| 2 | * Licensed to the Apache Software Foundation (ASF) under one | |
| 3 | * or more contributor license agreements. See the NOTICE file | |
| 4 | * distributed with this work for additional information | |
| 5 | * regarding copyright ownership. The ASF licenses this file | |
| 6 | * to you under the Apache License, Version 2.0 (the | |
| 7 | * "License"); you may not use this file except in compliance | |
| 8 | * with the License. You may obtain a copy of the License at | |
| 9 | * | |
| 10 | * http://www.apache.org/licenses/LICENSE-2.0 | |
| 11 | * | |
| 12 | * Unless required by applicable law or agreed to in writing, | |
| 13 | * software distributed under the License is distributed on an | |
| 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | |
| 15 | * KIND, either express or implied. See the License for the | |
| 16 | * specific language governing permissions and limitations under the License. | |
| 17 | */ | |
| 18 | package org.apache.shindig.social.opensocial.model; | |
| 19 | ||
| 20 | import org.apache.shindig.social.core.model.AccountImpl; | |
| 21 | ||
| 22 | import com.google.inject.ImplementedBy; | |
| 23 | ||
| 24 | /** | |
| 25 | * <p> | |
| 26 | * The Account interface describes the an account held by a person. Describes an account held by a | |
| 27 | * Person, which MAY be on the Service Provider's service, or MAY be on a different service. The | |
| 28 | * service provider does not have a requirement to verify that the account actually belongs to the | |
| 29 | * person that the account is connected to, and consumers are appropriately warned of this in the | |
| 30 | * Specification. | |
| 31 | * </p> | |
| 32 | * <p> | |
| 33 | * For each account, the domain is the top-most authoritative domain for this | |
| 34 | * account, e.g. yahoo.com or reader.google.com, and MUST be non-empty. Each account must also | |
| 35 | * contain a non-empty value for either username or userid, and MAY contain both, in which case the | |
| 36 | * two values MUST be for the same account. These accounts can be used to determine if a user on one | |
| 37 | * service is also known to be the same person on a different service, to facilitate connecting to | |
| 38 | * people the user already knows on different services. | |
| 39 | * <p> | |
| 40 | * <p> | |
| 41 | * Since V0.8.1 | |
| 42 | * </p> | |
| 43 | */ | |
| 44 | @ImplementedBy(AccountImpl.class) | |
| 45 | @Exportablebean | |
| 46 | public interface Account { | |
| 47 | ||
| 48 | ||
| 49 | /** | |
| 50 | * The fields that represent the account object in json form. | |
| 51 | * | |
| 52 | * <p> | |
| 53 | * All of the fields that an account can have, all fields are required | |
| 54 | * </p> | |
| 55 | * | |
| 56 | */ | |
| 57 | 0 | public static enum Field { |
| 58 | /** the json field for domain. */ | |
| 59 | 0 | DOMAIN("domain"), |
| 60 | /** the json field for userId. */ | |
| 61 | 0 | USER_ID("userId"), |
| 62 | /** the json field for username. */ | |
| 63 | 0 | USERNAME("username"); |
| 64 | ||
| 65 | /** | |
| 66 | * The json field that the instance represents. | |
| 67 | */ | |
| 68 | private final String jsonString; | |
| 69 | ||
| 70 | /** | |
| 71 | * create a field base on the a json element. | |
| 72 | * | |
| 73 | * @param jsonString the name of the element | |
| 74 | */ | |
| 75 | 0 | private Field(String jsonString) { |
| 76 | 0 | this.jsonString = jsonString; |
| 77 | 0 | } |
| 78 | ||
| 79 | /** | |
| 80 | * emit the field as a json element. | |
| 81 | * | |
| 82 | * @return the field name | |
| 83 | */ | |
| 84 | @Override | |
| 85 | public String toString() { | |
| 86 | 0 | return this.jsonString; |
| 87 | } | |
| 88 | } | |
| 89 | ||
| 90 | /** | |
| 91 | * The top-most authoritative domain for this account, e.g. "twitter.com". This is the Primary | |
| 92 | * Sub-Field for this field, for the purposes of sorting and filtering. | |
| 93 | * | |
| 94 | * @return the domain | |
| 95 | */ | |
| 96 | String getDomain(); | |
| 97 | ||
| 98 | /** | |
| 99 | * The top-most authoritative domain for this account, e.g. "twitter.com". This is the Primary | |
| 100 | * Sub-Field for this field, for the purposes of sorting and filtering. * | |
| 101 | * | |
| 102 | * @param domain the domain | |
| 103 | */ | |
| 104 | void setDomain(String domain); | |
| 105 | ||
| 106 | /** | |
| 107 | * A user ID number, usually chosen automatically, and usually numeric but sometimes alphanumeric, | |
| 108 | * e.g. "12345" or "1Z425A". | |
| 109 | * | |
| 110 | * @return the userId | |
| 111 | */ | |
| 112 | String getUserId(); | |
| 113 | ||
| 114 | /** | |
| 115 | * A user ID number, usually chosen automatically, and usually numeric but sometimes alphanumeric, | |
| 116 | * e.g. "12345" or "1Z425A". | |
| 117 | * | |
| 118 | * @param userId the userId | |
| 119 | */ | |
| 120 | void setUserId(String userId); | |
| 121 | ||
| 122 | /** | |
| 123 | * An alphanumeric user name, usually chosen by the user, e.g. "jsmarr". | |
| 124 | * | |
| 125 | * @return the username | |
| 126 | */ | |
| 127 | String getUsername(); | |
| 128 | ||
| 129 | /** | |
| 130 | * An alphanumeric user name, usually chosen by the user, e.g. "jsmarr". | |
| 131 | * | |
| 132 | * @param username the username | |
| 133 | */ | |
| 134 | void setUsername(String username); | |
| 135 | } |