メモ代わり。てきとーに。 いや、ですからてきとーですって。 2年前ぐらいにPythonあたりでメールくれた方、ごめんなさい。メール紛失してしまい無視した形になってしまいました。。。

2009年7月18日土曜日

[Apache Shindig][お勉強][OpenSocial] メモ58 DataRequest.newFetchPeopleRequestのサーバ側実装(1)

多分、newFetchPeopleRequestが発行されると、
JSON-RPCでpeople.getがリクエストされるんじゃないかと。

それはどうでも良いとして、サーバ側は、


org.apache.shindig.social.opensocial.spi.PersonService


を実装したクラスのgetPeopleメソッドがコールされる。

このgetPeopleのシグネチャは以下。

Future<RestfulCollection<Person>> getPeople(Set userIds, GroupId groupId,
CollectionOptions collectionOptions, Set<String> fields, SecurityToken token)
throws ProtocolException;


うへー。

UserIdは"VIEWER"、"OWNER"とか。
GroupIdは、"FRIENDS"とか"ALL"とか"SELF"とかが設定されている。
fieldsはnewFetchPeopleRequestの第二引数で指定した、

opensocial.DataRequest.PeopleRequestFields.PROFILE_DETAILS

の対応する値がセットされている。

tokenはiframeにセットしたstパラメータの値に対応するSecurityTokenオブジェクト。

collectionOptionsというのは、、、不明
* どの項目でソートするかより親しい友達順(topFriends)か名前順(name)か。
* ソートの順序(昇順か降順か)
* フィルター、
* 最大件数、
* 最初に表示するデータのインデックス、
* updatedSince
というのが入ってくる模様。
多分、PersonServiceをコールするPersonHandlerを見れば分かると思う。

ということで見てみようっと。

--
というか、newFetchPeopleRequestを

idSpecParam[opensocial.IdSpec.Field.GROUP_ID] = opensocial.IdSpec.PersonId.FRIENDS;

でコールしたのに、サーバ側には、GroupIdに"SELF"が設定されている!

なんで??

--

idSpecParam[opensocial.IdSpec.Field.GROUP_ID] = opensocial.IdSpec.GroupId.FRIENDS;

が正解。

.

[Apache Shindig][お勉強][OpenSocial] メモ57 DataRequest.newFetchPeopleRequest(友達版)

友達一覧を取得するには、

DataRequest.newFetchPeopleRequest()

を使うみたい。

さて、このリクエストのサーバ側の処理は、
newFetchPersonRequestで触ったPersonService.getPeople()
らしい。

とりあえずは、ガジェットを書いてみる。
newFetchPersonRequestの第一引数はidSpec。
第二引数は、要求に渡すパラメータ。
だそうで。

idSpecはidSpecオブジェクト。
要求に渡すパラメータというのは、意味不明。
要求に渡すといわれても、さっぱりわからないので、サンプルを見る。

で、例によって、gooのディベロッパーキッチンをみて、書いてみた。


<?xml version="1.0" encoding="UTF-8"?>
<Module>
<ModulePrefs title="友達一覧取得">
<Require feature="opensocial-0.8" />
<Require feature="dynamic-height" />
</ModulePrefs>
<Content type="html" view="home,profile,canvas"><![CDATA[
<div id='friends_list'></div>
<script type="text/javascript">

function requestGetOwnerProfile() {
var params = {};
params[opensocial.DataRequest.PeopleRequestFields.PROFILE_DETAILS] = [
opensocial.Person.Field.ID,
opensocial.Person.Field.NICKNAME,
opensocial.Person.Field.THUMBNAIL_URL,
opensocial.Person.Field.PROFILE_URL
];
var req = opensocial.newDataRequest();
var idSpecParam = {};
idSpecParam[opensocial.IdSpec.Field.USER_ID] = opensocial.IdSpec.PersonId.OWNER;
idSpecParam[opensocial.IdSpec.Field.GROUP_ID] = opensocial.IdSpec.PersonId.FRIENDS;
var idSpec = opensocial.newIdSpec(idSpecParam);

req.add(req.newFetchPeopleRequest(idSpec, params), "get_friends");
req.send(handleRequestGetFriendsProfile);
};

function handleRequestGetFriendsProfile(data) {
var friends = data.get("get_friends");
if (friends.hadError()) {
//Handle error using viewer.getError()...
document.getElementById('friends_list').innerHTML = 'エラーだよーん';
return;
}
var data = friends.getData();
var out = document.createElement('ul');
data.each(function(friend) {
var li = document.createElement('li');
var thumbnailUrl = friend.getField(opensocial.Person.Field.THUMBNAIL_URL);
li.innerHTML = '<img src="'+thumbnailUrl+'" />'+friend.getNickname();
out.appendChild(li);
});
docuemnt.getElementById('friends_list').appendChild(out);

// 自動調節
gadgets.window.adjustHeight();
};

gadgets.util.registerOnLoadHandler(requestGetOwnerProfile);

</script>
]]>
</Content>
</Module>



多分、こんな感じでよいんだろうけど、
エラーだよーんって表示される。

My Shindig環境ではまだサーバ側を実装していないので、
動かない。(java.lang.UnsupportedOperationExceptionが投げられてる。)

サーバ側実装はこれから。

.

[Apache Shindig][お勉強][OpenSocial] メモ56

とりあえず、
パーミッション判定、container.jsのsupportedFieldに対応した、
newFetchPersonRequestのサーバ側処理ができた。

さて、次は、、と。
友達一覧とかがほしいかも。

.

[Apache Shindig][お勉強][OpenSocial] メモ55 supportsFieldしながら全項目出力するガジェット

Personオブジェクトの全項目を、いちいちsupportsFieldしながら出力するうんこみたいなガジェット。


<?xml version="1.0" encoding="UTF-8"?>
<Module>
<ModulePrefs title="OWNER全情報取得">
<Require feature="opensocial-0.8" />
<Require feature="dynamic-height" />
</ModulePrefs>
<Content type="html" view="home,profile,canvas"><![CDATA[
<div id='owner_profile'></div>
<script type="text/javascript">

function requestGetOwnerProfile() {
var params = {};
params[opensocial.DataRequest.PeopleRequestFields.PROFILE_DETAILS] = [
opensocial.Person.Field.ID,
opensocial.Person.Field.NAME,
opensocial.Person.Field.NICKNAME,
opensocial.Person.Field.THUMBNAIL_URL,
opensocial.Person.Field.PROFILE_URL,
opensocial.Person.Field.CURRENT_LOCATION,
opensocial.Person.Field.ADDRESSES,
opensocial.Person.Field.EMAILS,
opensocial.Person.Field.PHONE_NUMBERS,
opensocial.Person.Field.ABOUT_ME,
opensocial.Person.Field.STATUS,
opensocial.Person.Field.PROFILE_SONG,
opensocial.Person.Field.PROFILE_VIDEO,
opensocial.Person.Field.GENDER,
opensocial.Person.Field.SEXUAL_ORIENTATION,
opensocial.Person.Field.RELATIONSHIP_STATUS,
opensocial.Person.Field.AGE,
opensocial.Person.Field.DATE_OF_BIRTH,
opensocial.Person.Field.BODY_TYPE,
opensocial.Person.Field.ETHNICITY,
opensocial.Person.Field.SMOKER,
opensocial.Person.Field.DRINKER,
opensocial.Person.Field.CHILDREN,
opensocial.Person.Field.PETS,
opensocial.Person.Field.LIVING_ARRANGEMENT,
opensocial.Person.Field.TIME_ZONE,
opensocial.Person.Field.LANGUAGES_SPOKEN,
opensocial.Person.Field.JOBS,
opensocial.Person.Field.JOB_INTERESTS,
opensocial.Person.Field.SCHOOLS,
opensocial.Person.Field.INTERESTS,
opensocial.Person.Field.URLS,
opensocial.Person.Field.MUSIC,
opensocial.Person.Field.MOVIES,
opensocial.Person.Field.TV_SHOWS,
opensocial.Person.Field.BOOKS,
opensocial.Person.Field.ACTIVITIES,
opensocial.Person.Field.SPORTS,
opensocial.Person.Field.HEROES,
opensocial.Person.Field.QUOTES,
opensocial.Person.Field.CARS,
opensocial.Person.Field.FOOD,
opensocial.Person.Field.TURN_ONS,
opensocial.Person.Field.TURN_OFFS,
opensocial.Person.Field.TAGS,
opensocial.Person.Field.ROMANCE,
opensocial.Person.Field.SCARED_OF,
opensocial.Person.Field.HAPPIEST_WHEN,
opensocial.Person.Field.FASHION,
opensocial.Person.Field.HUMOR,
opensocial.Person.Field.LOOKING_FOR,
opensocial.Person.Field.RELIGION,
opensocial.Person.Field.POLITICAL_VIEWS,
opensocial.Person.Field.HAS_APP,
opensocial.Person.Field.NETWORK_PRESENCE
];
var req = opensocial.newDataRequest();
req.add(req.newFetchPersonRequest(
opensocial.IdSpec.PersonId.OWNER,
params),
"get_owner");
req.send(handleRequestGetOwnerProfile);
};

function handleRequestGetOwnerProfile(data) {
var owner = data.get("get_owner");
if (owner.hadError()) {
//Handle error using viewer.getError()...
document.getElementById('owner_profile').innerHTML = 'エラーだよーん';
return;
}
var data = owner.getData();
var html = 'displayName:' + data.getDisplayName() + '<br />';
var env = opensocial.getEnvironment();
if (env.supportsField(opensocial.Environment.ObjectType.PERSON, opensocial.Person.Field.ID)) {
var id = data.getField(opensocial.Person.Field.ID);
var idHtml = '<h2>opensocial.Person.Field.ID</h2><br />';
if (id) {
idHtml = idHtml + id + '<br />';
}
else {
idHtml = idHtml + 'UNDEFINED<br />';
}
document.getElementById('view_ID').innerHTML = idHtml;
}
// Name
if (env.supportsField(opensocial.Environment.ObjectType.PERSON, opensocial.Person.Field.NAME)) {
var name = data.getField(opensocial.Person.Field.NAME);
var nameHtml = '<h2>opensocial.Person.Field.NAME</h2><br />';
if (name) {
if (env.supportsField(opensocial.Environment.ObjectType.NAME, opensocial.Name.Field.ADDITIONAL_NAME)) {
nameHtml = nameHtml + '<h3>opensocial.Name.Field.ADDITIONAL_NAME</h3><br />';
nameHtml = nameHtml + name.getField(opensocial.Name.Field.ADDITIONAL_NAME) + '<br />';
}
if (env.supportsField(opensocial.Environment.ObjectType.NAME, opensocial.Name.Field.FAMILY_NAME)) {
nameHtml = nameHtml + '<h3>opensocial.Name.Field.FAMILY_NAME</h3><br />';
nameHtml = nameHtml + name.getField(opensocial.Name.Field.FAMILY_NAME) + '<br />';
}
if (env.supportsField(opensocial.Environment.ObjectType.NAME, opensocial.Name.Field.GIVEN_NAME)) {
nameHtml = nameHtml + '<h3>opensocial.Name.Field.GIVEN_NAME</h3><br />';
nameHtml = nameHtml + name.getField(opensocial.Name.Field.GIVEN_NAME) + '<br />';
}
if (env.supportsField(opensocial.Environment.ObjectType.NAME, opensocial.Name.Field.HONORIFIC_PREFIX)) {
nameHtml = nameHtml + '<h3>opensocial.Name.Field.HONORIFIC_PREFIX</h3><br />';
nameHtml = nameHtml + name.getField(opensocial.Name.Field.HONORIFIC_PREFIX) + '<br />';
}
if (env.supportsField(opensocial.Environment.ObjectType.NAME, opensocial.Name.Field.HONORIFIC_SUFFIX)) {
nameHtml = nameHtml + '<h3>opensocial.Name.Field.HONORIFIC_SUFFIX</h3><br />';
nameHtml = nameHtml + name.getField(opensocial.Name.Field.HONORIFIC_SUFFIX) + '<br />';
}
if (env.supportsField(opensocial.Environment.ObjectType.NAME, opensocial.Name.Field.UNSTRUCTURED)) {
nameHtml = nameHtml + '<h3>opensocial.Name.Field.UNSTRUCTURED</h3><br />';
nameHtml = nameHtml + name.getField(opensocial.Name.Field.UNSTRUCTURED) + '<br />';
}
}
else {
nameHtml = nameHtml + 'UNDEFINED<br />';
}
document.getElementById('view_NAME').innerHTML = nameHtml;
}
else {
document.getElementById('view_NAME').innerHTML = '未対応';
}
if (env.supportsField(opensocial.Environment.ObjectType.PERSON, opensocial.Person.Field.NICKNAME)) {
var nickname = data.getField(opensocial.Person.Field.NICKNAME);
var nicknameHtml = '<h2>opensocial.Person.Field.NICKNAME</h2><br />';
if (nickname) {
nicknameHtml = nicknameHtml + nickname + '<br />';
}
else {
nicknameHtml = nicknameHtml + 'UNDEFINED<br />';
}
document.getElementById('view_NICKNAME').innerHTML = nicknameHtml;
}
if (env.supportsField(opensocial.Environment.ObjectType.PERSON, opensocial.Person.Field.THUMBNAIL_URL)) {
var thumbnailUrl = data.getField(opensocial.Person.Field.THUMBNAIL_URL);
var thumbnailUrlHtml = '<h2>opensocial.Person.Field.THUMBNAIL_URL</h2><br />';
if (thumbnailUrl) {
thumbnailUrlHtml = thumbnailUrlHtml + thumbnailUrl + '<br />';
}
else {
thumbnailUrlHtml = thumbnailUrlHtml + 'UNDEFINED<br />';
}
document.getElementById('view_THUMBNAIL_URL').innerHTML = thumbnailUrlHtml;
}
if (env.supportsField(opensocial.Environment.ObjectType.PERSON, opensocial.Person.Field.PROFILE_URL)) {
var profileUrl = data.getField(opensocial.Person.Field.PROFILE_URL);
var profileUrlHtml = '<h2>opensocial.Person.Field.PROFILE_URL</h2><br />';
if (profileUrl) {
profileUrlHtml = profileUrlHtml + profileUrl + '<br />';
}
else {
profileUrlHtml = profileUrlHtml + 'UNDEFINED<br />';
}
document.getElementById('view_PROFILE_URL').innerHTML = profileUrlHtml;
}
if (env.supportsField(opensocial.Environment.ObjectType.PERSON, opensocial.Person.Field.CURRENT_LOCATION)) {
var currentLocation = data.getField(opensocial.Person.Field.CURRENT_LOCATION);
var currentLocationHtml = '<h2>opensocial.Person.Field.CURRENT_LOCATION</h2><br />';
if (currentLocation) {
if (env.supportsField(opensocial.Environment.ObjectType.ADDRESS, opensocial.Address.Field.COUNTRY)) {
currentLocationHtml = currentLocationHtml + '<h3>opensocial.Address.Field.COUNTRY</h3><br />';
currentLocationHtml = currentLocationHtml + currentLocation.getField(opensocial.Address.Field.COUNTRY) + '<br />';
}
if (env.supportsField(opensocial.Environment.ObjectType.ADDRESS, opensocial.Address.Field.EXTENDED_ADDRESS)) {
currentLocationHtml = currentLocationHtml + '<h3>opensocial.Address.Field.EXTENDED_ADDRESS</h3><br />';
currentLocationHtml = currentLocationHtml + currentLocation.getField(opensocial.Address.Field.EXTENDED_ADDRESS) + '<br />';
}
if (env.supportsField(opensocial.Environment.ObjectType.ADDRESS, opensocial.Address.Field.LATITUDE)) {
currentLocationHtml = currentLocationHtml + '<h3>opensocial.Address.Field.LATITUDE</h3><br />';
currentLocationHtml = currentLocationHtml + currentLocation.getField(opensocial.Address.Field.LATITUDE) + '<br />';
}
if (env.supportsField(opensocial.Environment.ObjectType.ADDRESS, opensocial.Address.Field.LOCALITY)) {
currentLocationHtml = currentLocationHtml + '<h3>opensocial.Address.Field.LOCALITY</h3><br />';
currentLocationHtml = currentLocationHtml + currentLocation.getField(opensocial.Address.Field.LOCALITY) + '<br />';
}
if (env.supportsField(opensocial.Environment.ObjectType.ADDRESS, opensocial.Address.Field.LONGITUDE)) {
currentLocationHtml = currentLocationHtml + '<h3>opensocial.Address.Field.LONGITUDE</h3><br />';
currentLocationHtml = currentLocationHtml + currentLocation.getField(opensocial.Address.Field.LONGITUDE) + '<br />';
}
if (env.supportsField(opensocial.Environment.ObjectType.ADDRESS, opensocial.Address.Field.PO_BOX)) {
currentLocationHtml = currentLocationHtml + '<h3>opensocial.Address.Field.PO_BOX</h3><br />';
currentLocationHtml = currentLocationHtml + currentLocation.getField(opensocial.Address.Field.PO_BOX) + '<br />';
}
if (env.supportsField(opensocial.Environment.ObjectType.ADDRESS, opensocial.Address.Field.POSTAL_CODE)) {
currentLocationHtml = currentLocationHtml + '<h3>opensocial.Address.Field.POSTAL_CODE</h3><br />';
currentLocationHtml = currentLocationHtml + currentLocation.getField(opensocial.Address.Field.POSTAL_CODE) + '<br />';
}
if (env.supportsField(opensocial.Environment.ObjectType.ADDRESS, opensocial.Address.Field.REGION)) {
currentLocationHtml = currentLocationHtml + '<h3>opensocial.Address.Field.REGION</h3><br />';
currentLocationHtml = currentLocationHtml + currentLocation.getField(opensocial.Address.Field.REGION) + '<br />';
}
if (env.supportsField(opensocial.Environment.ObjectType.ADDRESS, opensocial.Address.Field.STREET_ADDRESS)) {
currentLocationHtml = currentLocationHtml + '<h3>opensocial.Address.Field.STREET_ADDRESS</h3><br />';
currentLocationHtml = currentLocationHtml + currentLocation.getField(opensocial.Address.Field.STREET_ADDRESS) + '<br />';
}
if (env.supportsField(opensocial.Environment.ObjectType.ADDRESS, opensocial.Address.Field.TYPE)) {
currentLocationHtml = currentLocationHtml + '<h3>opensocial.Address.Field.TYPE</h3><br />';
currentLocationHtml = currentLocationHtml + currentLocation.getField(opensocial.Address.Field.TYPE) + '<br />';
}
if (env.supportsField(opensocial.Environment.ObjectType.ADDRESS, opensocial.Address.Field.UNSTRUCTURED_ADDRESS)) {
currentLocationHtml = currentLocationHtml + '<h3>opensocial.Address.Field.UNSTRUCTURED_ADDRESS</h3><br />';
currentLocationHtml = currentLocationHtml + currentLocation.getField(opensocial.Address.Field.UNSTRUCTURED_ADDRESS) + '<br />';
}
}
else {
currentLocationHtml = currentLocationHtml + 'UNDEFINED<br />';
}
document.getElementById('view_CURRENT_LOCATION')
.innerHTML = currentLocationHtml;
}
if (env.supportsField(opensocial.Environment.ObjectType.PERSON, opensocial.Person.Field.ADDRESSES)) {
var addresses = data.getField(opensocial.Person.Field.ADDRESSES);
var addressHtml = '<h2>opensocial.Person.Field.ADDRESSES</h2><br />';
if (addresses) {
for (xx in addresses) {
if (env.supportsField(opensocial.Environment.ObjectType.ADDRESS, opensocial.Address.Field.COUNTRY)) {
addressHtml = addressHtml + '<h3>opensocial.Address.Field.COUNTRY</h3><br />';
addressHtml = addressHtml + addresses[xx].getField(opensocial.Address.Field.COUNTRY) + '<br />';
}
if (env.supportsField(opensocial.Environment.ObjectType.ADDRESS, opensocial.Address.Field.EXTENDED_ADDRESS)) {
addressHtml = addressHtml + '<h3>opensocial.Address.Field.EXTENDED_ADDRESS</h3><br />';
addressHtml = addressHtml + addresses[xx].getField(opensocial.Address.Field.EXTENDED_ADDRESS) + '<br />';
}
if (env.supportsField(opensocial.Environment.ObjectType.ADDRESS, opensocial.Address.Field.LATITUDE)) {
addressHtml = addressHtml + '<h3>opensocial.Address.Field.LATITUDE</h3><br />';
addressHtml = addressHtml + addresses[xx].getField(opensocial.Address.Field.LATITUDE) + '<br />';
}
if (env.supportsField(opensocial.Environment.ObjectType.ADDRESS, opensocial.Address.Field.LOCALITY)) {
addressHtml = addressHtml + '<h3>opensocial.Address.Field.LOCALITY</h3><br />';
addressHtml = addressHtml + addresses[xx].getField(opensocial.Address.Field.LOCALITY) + '<br />';
}
if (env.supportsField(opensocial.Environment.ObjectType.ADDRESS, opensocial.Address.Field.LONGITUDE)) {
addressHtml = addressHtml + '<h3>opensocial.Address.Field.LONGITUDE</h3><br />';
addressHtml = addressHtml + addresses[xx].getField(opensocial.Address.Field.LONGITUDE) + '<br />';
}
if (env.supportsField(opensocial.Environment.ObjectType.ADDRESS, opensocial.Address.Field.PO_BOX)) {
addressHtml = addressHtml + '<h3>opensocial.Address.Field.PO_BOX</h3><br />';
addressHtml = addressHtml + addresses[xx].getField(opensocial.Address.Field.PO_BOX) + '<br />';
}
if (env.supportsField(opensocial.Environment.ObjectType.ADDRESS, opensocial.Address.Field.POSTAL_CODE)) {
addressHtml = addressHtml + '<h3>opensocial.Address.Field.POSTAL_CODE</h3><br />';
addressHtml = addressHtml + addresses[xx].getField(opensocial.Address.Field.POSTAL_CODE) + '<br />';
}
if (env.supportsField(opensocial.Environment.ObjectType.ADDRESS, opensocial.Address.Field.REGION)) {
addressHtml = addressHtml + '<h3>opensocial.Address.Field.REGION</h3><br />';
addressHtml = addressHtml + addresses[xx].getField(opensocial.Address.Field.REGION) + '<br />';
}
if (env.supportsField(opensocial.Environment.ObjectType.ADDRESS, opensocial.Address.Field.STREET_ADDRESS)) {
addressHtml = addressHtml + '<h3>opensocial.Address.Field.STREET_ADDRESS</h3><br />';
addressHtml = addressHtml + addresses[xx].getField(opensocial.Address.Field.STREET_ADDRESS) + '<br />';
}
if (env.supportsField(opensocial.Environment.ObjectType.ADDRESS, opensocial.Address.Field.TYPE)) {
addressHtml = addressHtml + '<h3>opensocial.Address.Field.TYPE</h3><br />';
addressHtml = addressHtml + addresses[xx].getField(opensocial.Address.Field.TYPE) + '<br />';
}
if (env.supportsField(opensocial.Environment.ObjectType.ADDRESS, opensocial.Address.Field.UNSTRUCTURED_ADDRESS)) {
addressHtml = addressHtml + '<h3>opensocial.Address.Field.UNSTRUCTURED_ADDRESS</h3><br />';
addressHtml = addressHtml + addresses[xx].getField(opensocial.Address.Field.UNSTRUCTURED_ADDRESS) + '<br />';
}

addressHtml = addressHtml + xx + '番目終わり----------------------------------------------------------<br />';
}
}
else {
addressHtml = addressHtml + 'UNDEFINED<br />';
}
document.getElementById('view_ADDRESSES').innerHTML = addressHtml;
}
if (env.supportsField(opensocial.Environment.ObjectType.PERSON, opensocial.Person.Field.EMAILS)) {
var emails = data.getField(opensocial.Person.Field.EMAILS);
var emailHtml = '<h2>opensocial.Person.Field.EMAILS</h2><br />';
if (emails) {
for (xx in emails) {
if (env.supportsField(opensocial.Environment.ObjectType.EMAIL, opensocial.Email.Field.ADDRESS)) {
emailHtml = emailHtml + '<h3>opensocial.Email.Field.ADDRESS</h3><br />';
emailHtml = emailHtml + emails[xx].getField(opensocial.Email.Field.ADDRESS) + '<br />';
}
if (env.supportsField(opensocial.Environment.ObjectType.EMAIL, opensocial.Email.Field.TYPE)) {
emailHtml = emailHtml + '<h3>opensocial.Email.Field.TYPE</h3><br />';
emailHtml = emailHtml + emails[xx].getField(opensocial.Email.Field.TYPE) + '<br />';
}
emailHtml = emailHtml + xx + '番目終了 --------------------------------------<br />';
}
}
else {
emailHtml = emailHtml + 'UNDEFINED<br />';
}
document.getElementById('view_EMAILS').innerHTML = emailHtml;
}
if (env.supportsField(opensocial.Environment.ObjectType.PERSON, opensocial.Person.Field.PHONE_NUMBERS)) {
var phones = data.getField(opensocial.Person.Field.PHONE_NUMBERS);
var phoneHtml = '<h2>opensocial.Person.Field.PHONE_NUMBERS</h2><br />';
if (phones) {
for (xx in phones) {
if (env.supportsField(opensocial.Environment.ObjectType.PHONE, opensocial.Phone.Field.NUMBER)) {
phoneHtml = phoneHtml + '<h3>opensocial.Phone.Field.NUMBER</h3><br />';
phoneHtml = phoneHtml + phones[xx].getField(opensocial.Phone.Field.NUMBER) + '<br />';
}
if (env.supportsField(opensocial.Environment.ObjectType.PHONE, opensocial.Phone.Field.TYPE)) {
phoneHtml = phoneHtml + '<h3>opensocial.Phone.Field.TYPE</h3><br />';
phoneHtml = phoneHtml + phones[xx].getField(opensocial.Phone.Field.TYPE) + '<br />';
}
phoneHtml = phoneHtml + xx + '番目終了 --------------------------------------<br />';
}
}
else {
phoneHtml = phoneHtml + 'UNDEFINED<br />';
}
document.getElementById('view_PHONE_NUMBERS').innerHTML = phoneHtml;
}
if (env.supportsField(opensocial.Environment.ObjectType.PERSON, opensocial.Person.Field.ABOUT_ME)) {
var aboutMe = data.getField(opensocial.Person.Field.ABOUT_ME);
var aboutMeHtml = '<h2>opensocial.Person.Field.ABOUT_ME</h2><br />';
if (aboutMe) {
aboutMeHtml = aboutMeHtml + aboutMe + '<br />';
}
else {
aboutMeHtml = aboutMeHtml + 'UNDEFINED<br />';
}
document.getElementById('view_ABOUT_ME').innerHTML = aboutMeHtml;
}
if (env.supportsField(opensocial.Environment.ObjectType.PERSON, opensocial.Person.Field.STATUS)) {
var status = data.getField(opensocial.Person.Field.STATUS);
var statusHtml = '<h2>opensocial.Person.Field.STATUS</h2><br />';
if (status) {
statusHtml = statusHtml + status + '<br />';
}
else {
statusHtml = statusHtml + 'UNDEFINED<br />';
}
document.getElementById('view_STATUS').innerHTML = statusHtml;
}
if (env.supportsField(opensocial.Environment.ObjectType.PERSON, opensocial.Person.Field.PROFILE_SONG)) {
var profileSong = data.getField(opensocial.Person.Field.PROFILE_SONG);
var profileSongHtml = '<h2>opensocial.Person.Field.PROFILE_SONG</h2><br />';
if (profileSong) {
if (env.supportsField(opensocial.Environment.ObjectType.URL, opensocial.Url.Field.ADDRESS)) {
profileSongHtml = profileSongHtml + '<h3>opensocial.Url.Field.ADDRESS</h3><br />';
profileSongHtml = profileSongHtml + profileSong.getField(opensocial.Url.Field.ADDRESS) + '<br />';
}
if (env.supportsField(opensocial.Environment.ObjectType.URL, opensocial.Url.Field.LINK_TEXT)) {
profileSongHtml = profileSongHtml + '<h3>opensocial.Url.Field.LINK_TEXT</h3><br />';
profileSongHtml = profileSongHtml + profileSong.getField(opensocial.Url.Field.LINK_TEXT) + '<br />';
}
if (env.supportsField(opensocial.Environment.ObjectType.URL, opensocial.Url.Field.TYPE)) {
profileSongHtml = profileSongHtml + '<h3>opensocial.Url.Field.TYPE</h3><br />';
profileSongHtml = profileSongHtml + profileSong.getField(opensocial.Url.Field.TYPE) + '<br />';
}
}
else {
profileSongHtml = profileSongHtml + 'UNDEFINED<br />';
}
document.getElementById('view_PROFILE_SONG').innerHTML = profileSongHtml;
}
if (env.supportsField(opensocial.Environment.ObjectType.PERSON, opensocial.Person.Field.PROFILE_VIDEO)) {
var profileVideo = data.getField(opensocial.Person.Field.PROFILE_VIDEO);
var profileVideoHtml = '<h2>opensocial.Person.Field.PROFILE_VIDEO</h2><br />';
if (profileVideo) {
if (env.supportsField(opensocial.Environment.ObjectType.URL, opensocial.Url.Field.ADDRESS)) {
profileVideoHtml = profileVideoHtml + '<h3>opensocial.Url.Field.ADDRESS</h3><br />';
profileVideoHtml = profileVideoHtml + profileVideo.getField(opensocial.Url.Field.ADDRESS) + '<br />';
}
if (env.supportsField(opensocial.Environment.ObjectType.URL, opensocial.Url.Field.LINK_TEXT)) {
profileVideoHtml = profileVideoHtml + '<h3>opensocial.Url.Field.LINK_TEXT</h3><br />';
profileVideoHtml = profileVideoHtml + profileVideo.getField(opensocial.Url.Field.LINK_TEXT) + '<br />';
}
if (env.supportsField(opensocial.Environment.ObjectType.URL, opensocial.Url.Field.TYPE)) {
profileVideoHtml = profileVideoHtml + '<h3>opensocial.Url.Field.TYPE</h3><br />';
profileVideoHtml = profileVideoHtml + profileVideo.getField(opensocial.Url.Field.TYPE) + '<br />';
}
}
else {
profileVideoHtml = profileVideoHtml + 'UNDEFINED<br />';
}
document.getElementById('view_PROFILE_VIDEO').innerHTML = profileVideoHtml;
}
if (env.supportsField(opensocial.Environment.ObjectType.PERSON, opensocial.Person.Field.GENDER)) {
var gender = data.getField(opensocial.Person.Field.GENDER);
var genderHtml = '<h2>opensocial.Person.Field.GENDER</h2><br />';
if (gender) {
genderHtml = genderHtml + gender.getDisplayValue() + '<br />';
}
else {
genderHtml = genderHtml + 'UNDEFINED<br />';
}
document.getElementById('view_GENDER').innerHTML = genderHtml;
}
if (env.supportsField(opensocial.Environment.ObjectType.PERSON, opensocial.Person.Field.SEXUAL_ORIENTATION)) {
var sexualOrientation = data.getField(opensocial.Person.Field.SEXUAL_ORIENTATION);
var sexualOrientationHtml = '<h2>opensocial.Person.Field.SEXUAL_ORIENTATION</h2><br />';
if (sexualOrientation) {
sexualOrientationHtml = sexualOrientationHtml + sexualOrientation + '<br />';
}
else {
sexualOrientationHtml = sexualOrientationHtml + 'UNDEFINED<br />';
}
document.getElementById('view_SEXUAL_ORIENTATION').innerHTML = sexualOrientationHtml;
}
if (env.supportsField(opensocial.Environment.ObjectType.PERSON, opensocial.Person.Field.RELATIONSHIP_STATUS)) {
var relationshipStatus = data.getField(opensocial.Person.Field.RELATIONSHIP_STATUS);
var relationshipStatusHtml = '<h2>opensocial.Person.Field.RELATIONSHIP_STATUS</h2><br />';
if (relationshipStatus) {
relationshipStatusHtml = relationshipStatusHtml + relationshipStatus + '<br />';
}
else {
relationshipStatusHtml = relationshipStatusHtml + 'UNDEFINED<br />';
}
document.getElementById('view_RELATIONSHIP_STATUS').innerHTML = relationshipStatusHtml;
}
if (env.supportsField(opensocial.Environment.ObjectType.PERSON, opensocial.Person.Field.AGE)) {
var age = data.getField(opensocial.Person.Field.AGE);
var ageHtml = '<h2>opensocial.Person.Field.AGE</h2><br />';
if (age) {
ageHtml = ageHtml + age + '<br />';
}
else {
ageHtml = ageHtml + 'UNDEFINED<br />';
}
document.getElementById('view_AGE').innerHTML = ageHtml;

}
if (env.supportsField(opensocial.Environment.ObjectType.PERSON, opensocial.Person.Field.DATE_OF_BIRTH)) {
var dateOfBirth = data.getField(opensocial.Person.Field.DATE_OF_BIRTH);
var dateOfBirthHtml = '<h2>opensocial.Person.Field.DATE_OF_BIRTH</h2><br />';
if (dateOfBirth) {
dateOfBirthHtml = dateOfBirthHtml + dateOfBirth + '<br />';
}
else {
dateOfBirthHtml = dateOfBirthHtml + 'UNDEFINED<br />';
}
document.getElementById('view_DATE_OF_BIRTH').innerHTML = dateOfBirthHtml;

}
if (env.supportsField(opensocial.Environment.ObjectType.PERSON, opensocial.Person.Field.BODY_TYPE)) {
var bodyType = data.getField(opensocial.Person.Field.BODY_TYPE);
var bodyTypeHtml = '<h2>opensocial.Person.Field.BODY_TYPE</h2><br />';
if (bodyType) {
if (env.supportsField(opensocial.Environment.ObjectType.BODY_TYPE, opensocial.BodyType.Field.BUILD)) {
var build = bodyType.getField(opensocial.BodyType.Field.BUILD);
var buildHtml = '<h3>opensocial.BodyType.Field.BUILD</h3><br />';
if (build) {
buildHtml = buildHtml + build + '<br />';
}
else {
buildHtml = buildHtml + 'UNDEFINED<br />';
}
bodyTypeHtml = bodyTypeHtml + buildHtml;
}
if (env.supportsField(opensocial.Environment.ObjectType.BODY_TYPE, opensocial.BodyType.Field.EYE_COLOR)) {
var eyeColor = bodyType.getField(opensocial.BodyType.Field.EYE_COLOR);
var eyeColorHtml = '<h3>opensocial.BodyType.Field.EYE_COLOR</h3><br />';
if (eyeColor) {
eyeColorHtml = eyeColorHtml + eyeColor + '<br />';
}
else {
eyeColorHtml = eyeColorHtml + 'UNDEFINED<br />';
}
bodyTypeHtml = bodyTypeHtml + eyeColorHtml;
}
if (env.supportsField(opensocial.Environment.ObjectType.BODY_TYPE, opensocial.BodyType.Field.HAIR_COLOR)) {
var hairColor = bodyType.getField(opensocial.BodyType.Field.HAIR_COLOR);
var hairColorHtml = '<h3>opensocial.BodyType.Field.HAIR_COLOR</h3><br />';
if (hairColor) {
hairColorHtml = hairColorHtml + hairColor + '<br />';
}
else {
hairColorHtml = hairColorHtml + 'UNDEFINED<br />';
}
bodyTypeHtml = bodyTypeHtml + hairColorHtml;
}
if (env.supportsField(opensocial.Environment.ObjectType.BODY_TYPE, opensocial.BodyType.Field.HEIGHT)) {
var height = bodyType.getField(opensocial.BodyType.Field.HEIGHT);
var heightHtml = '<h3>opensocial.BodyType.Field.HEIGHT</h3><br />';
if (! isNaN(height)) {
heightHtml = heightHtml + height + '<br />';
}
else {
heightHtml = heightHtml + 'UNDEFINED<br />';
}
bodyTypeHtml = bodyTypeHtml + heightHtml;
}
if (env.supportsField(opensocial.Environment.ObjectType.BODY_TYPE, opensocial.BodyType.Field.WEIGHT)) {
var weight = bodyType.getField(opensocial.BodyType.Field.WEIGHT);
var weightHtml = '<h3>opensocial.BodyType.Field.WEIGHT</h3><br />';
if (! isNaN(weight)) {
weightHtml = weightHtml + weight + '<br />';
}
else {
weightHtml = weightHtml + 'UNDEFINED<br />';
}
bodyTypeHtml = bodyTypeHtml + weightHtml;
}
}
else {
bodyTypeHtml = bodyTypeHtml + 'UNDEFINED<br />';
}
document.getElementById('view_BODY_TYPE').innerHTML = bodyTypeHtml;
}
if (env.supportsField(opensocial.Environment.ObjectType.PERSON, opensocial.Person.Field.ETHNICITY)) {
var ethnicity = data.getField(opensocial.Person.Field.ETHNICITY);
var ethnicityHtml = '<h2>opensocial.Person.Field.ETHNICITY</h2><br />';
if (ethnicity) {
ethnicityHtml = ethnicityHtml + ethnicity;
}
else {
ethnicityHtml = ethnicityHtml + 'UNDEFINED<br />';
}
document.getElementById('view_ETHNICITY').innerHTML = ethnicityHtml;
}
if (env.supportsField(opensocial.Environment.ObjectType.PERSON, opensocial.Person.Field.SMOKER)) {
var smoker = data.getField(opensocial.Person.Field.SMOKER);
var smokerHtml = '<h2>opensocial.Person.Field.SMOKER</h2><br />';
if (smoker) {
smokerHtml = smokerHtml + smoker.getDisplayValue();
}
else {
smokerHtml = smokerHtml + 'UNDEFINED<br />';
}
document.getElementById('view_SMOKER').innerHTML = smokerHtml;
}
if (env.supportsField(opensocial.Environment.ObjectType.PERSON, opensocial.Person.Field.DRINKER)) {
var drinker = data.getField(opensocial.Person.Field.DRINKER);
var drinkerHtml = '<h2>opensocial.Person.Field.DRINKER</h2><br />';
if (drinker) {
drinkerHtml = drinkerHtml + drinker.getDisplayValue();
}
else {
drinkerHtml = drinkerHtml + 'UNDEFINED<br />';
}
document.getElementById('view_DRINKER').innerHTML = drinkerHtml;

}
if (env.supportsField(opensocial.Environment.ObjectType.PERSON, opensocial.Person.Field.CHILDREN)) {
var children = data.getField(opensocial.Person.Field.CHILDREN);
var childrenHtml = '<h2>opensocial.Person.Field.CHILDREN</h2><br />';
if (children) {
childrenHtml = childrenHtml + children + '<br />';
}
else {
childrenHtml = childrenHtml + 'UNDEFINED<br />';
}
document.getElementById('view_CHILDREN').innerHTML = childrenHtml;
}
if (env.supportsField(opensocial.Environment.ObjectType.PERSON, opensocial.Person.Field.PETS)) {
var pets = data.getField(opensocial.Person.Field.PETS);
var petsHtml = '<h2>opensocial.Person.Field.PETS</h2><br />';
if (pets) {
petsHtml = petsHtml + pets + '<br />';
}
else {
petsHtml = petsHtml + 'UNDEFINED<br />';
}
document.getElementById('view_PETS').innerHTML = petsHtml;
}
if (env.supportsField(opensocial.Environment.ObjectType.PERSON, opensocial.Person.Field.LIVING_ARRANGEMENT)) {
var livingArrangement = data.getField(opensocial.Person.Field.LIVING_ARRANGEMENT);
var livingArrangementHtml = '<h2>opensocial.Person.Field.LIVING_ARRANGEMENT</h2><br />';
if (livingArrangement) {
livingArrangementHtml = livingArrangementHtml + livingArrangement + '<br />';
}
else {
livingArrangementHtml = livingArrangementHtml + 'UNDEFINED<br />';
}
document.getElementById('view_LIVING_ARRANGEMENT').innerHTML = livingArrangementHtml;
}
if (env.supportsField(opensocial.Environment.ObjectType.PERSON, opensocial.Person.Field.TIME_ZONE)) {
var timeZone = data.getField(opensocial.Person.Field.TIME_ZONE);
var timeZoneHtml = '<h2>opensocial.Person.Field.TIME_ZONE</h2><br />';
if (timeZone) {
timeZoneHtml = timeZoneHtml + timeZone + '<br />';
}
else {
timeZoneHtml = timeZoneHtml + 'UNDEFINED<br />';
}
document.getElementById('view_TIME_ZONE').innerHTML = timeZoneHtml;

}
if (env.supportsField(opensocial.Environment.ObjectType.PERSON, opensocial.Person.Field.LANGUAGE_SPOKEN)) {
var languagesSpoken = data.getField(opensocial.Person.Field.LANGUAGES_SPOKEN);
var languagesSpokenHtml = '<h2>opensocial.Person.Field.LANGUAGES_SPOKEN</h2><br />';
if (languagesSpoken) {
languagesSpokenHtml = languagesSpokenHtml + languagesSpoken + '<br />';
}
else {
languagesSpokenHtml = languagesSpokenHtml + 'UNDEFINED<br />';
}
document.getElementById('view_LANGUAGES_SPOKEN').innerHTML = languagesSpokenHtml;

}
if (env.supportsField(opensocial.Environment.ObjectType.PERSON, opensocial.Person.Field.JOBS)) {
var jobs = data.getField(opensocial.Person.Field.JOBS);
var jobsHtml = '<h2>opensocial.Person.Field.JOBS</h2><br />';
if (jobs) {
for (xx in jobs) {
if (env.supportsField(opensocial.Environment.ObjectType.ORGANIZATION, opensocial.Organization.Field.NAME)) {
jobsHtml = jobsHtml + '<h3>opensocial.Organization.Field.NAME</h3>';
jobsHtml = jobsHtml + jobs[xx].getField(opensocial.Organization.Field.NAME) + '<br />';
}
if (env.supportsField(opensocial.Environment.ObjectType.ORGANIZATION, opensocial.Organization.Field.ADDRESS)) {
var address = jobs[xx].getField(opensocial.Organization.Field.ADDRESS);
jobsHtml = jobsHtml + '<h3>opensocial.Organization.Field.ADDRESS</h3>';

if (address) {
if (env.supportsField(opensocial.Environment.ObjectType.ADDRESS, opensocial.Address.Field.COUNTRY)) {
jobsHtml = jobsHtml + '<h4>opensocial.Address.Field.COUNTRY</h4>';
jobsHtml = jobsHtml + address.getField(opensocial.Address.Field.COUNTRY) + '<br />';
}
if (env.supportsField(opensocial.Environment.ObjectType.ADDRESS, opensocial.Address.Field.EXTENDED_ADDRESS)) {
jobsHtml = jobsHtml + '<h4>opensocial.Address.Field.EXTENDED_ADDRESS</h4>';
jobsHtml = jobsHtml + address.getField(opensocial.Address.Field.EXTENDED_ADDRESS) + '<br />';
}
if (env.supportsField(opensocial.Environment.ObjectType.ADDRESS, opensocial.Address.Field.LATITUDE)) {
jobsHtml = jobsHtml + '<h4>opensocial.Address.Field.LATITUDE</h4>';
jobsHtml = jobsHtml + address.getField(opensocial.Address.Field.LATITUDE) + '<br />';
}
if (env.supportsField(opensocial.Environment.ObjectType.ADDRESS, opensocial.Address.Field.LOCALITY)) {
jobsHtml = jobsHtml + '<h4>opensocial.Address.Field.LOCALITY</h4>';
jobsHtml = jobsHtml + address.getField(opensocial.Address.Field.LOCALITY) + '<br />';
}
if (env.supportsField(opensocial.Environment.ObjectType.ADDRESS, opensocial.Address.Field.LONGITUDE)) {
jobsHtml = jobsHtml + '<h4>opensocial.Address.Field.LONGITUDE</h4>';
jobsHtml = jobsHtml + address.getField(opensocial.Address.Field.LONGITUDE) + '<br />';
}
if (env.supportsField(opensocial.Environment.ObjectType.ADDRESS, opensocial.Address.Field.PO_BOX)) {
jobsHtml = jobsHtml + '<h4>opensocial.Address.Field.PO_BOX</h4>';
jobsHtml = jobsHtml + address.getField(opensocial.Address.Field.PO_BOX) + '<br />';
}
if (env.supportsField(opensocial.Environment.ObjectType.ADDRESS, opensocial.Address.Field.POSTAL_CODE)) {
jobsHtml = jobsHtml + '<h4>opensocial.Address.Field.POSTAL_CODE</h4>';
jobsHtml = jobsHtml + address.getField(opensocial.Address.Field.POSTAL_CODE) + '<br />';
}
if (env.supportsField(opensocial.Environment.ObjectType.ADDRESS, opensocial.Address.Field.REGION)) {
jobsHtml = jobsHtml + '<h4>opensocial.Address.Field.REGION</h4>';
jobsHtml = jobsHtml + address.getField(opensocial.Address.Field.REGION) + '<br />';
}
if (env.supportsField(opensocial.Environment.ObjectType.ADDRESS, opensocial.Address.Field.STREET_ADDRESS)) {
jobsHtml = jobsHtml + '<h4>opensocial.Address.Field.STREET_ADDRESS</h4>';
jobsHtml = jobsHtml + address.getField(opensocial.Address.Field.STREET_ADDRESS) + '<br />';
}
if (env.supportsField(opensocial.Environment.ObjectType.ADDRESS, opensocial.Address.Field.TYPE)) {
jobsHtml = jobsHtml + '<h4>opensocial.Address.Field.TYPE</h4>';
jobsHtml = jobsHtml + address.getField(opensocial.Address.Field.TYPE) + '<br />';
}
if (env.supportsField(opensocial.Environment.ObjectType.ADDRESS, opensocial.Address.Field.UNSTRUCTURED_ADDRESS)) {
jobsHtml = jobsHtml + '<h4>opensocial.Address.Field.UNSTRUCTURED_ADDRESS</h4>';
jobsHtml = jobsHtml + address.getField(opensocial.Address.Field.UNSTRUCTURED_ADDRESS) + '<br />';
}
}
}
if (env.supportsField(opensocial.Environment.ObjectType.ORGANIZATION, opensocial.Organization.Field.DESCRIPTION)) {
jobsHtml = jobsHtml + '<h3>opensocial.Organization.Field.DESCRIPTION</h3>';
jobsHtml = jobsHtml + jobs[xx].getField(opensocial.Organization.Field.DESCRIPTION) + '<br />';
}
if (env.supportsField(opensocial.Environment.ObjectType.ORGANIZATION, opensocial.Organization.Field.END_DATE)) {
jobsHtml = jobsHtml + '<h3>opensocial.Organization.Field.END_DATE</h3>';
jobsHtml = jobsHtml + jobs[xx].getField(opensocial.Organization.Field.END_DATE) + '<br />';
}
if (env.supportsField(opensocial.Environment.ObjectType.ORGANIZATION, opensocial.Organization.Field.FIELD)) {
jobsHtml = jobsHtml + '<h3>opensocial.Organization.Field.FIELD</h3>';
jobsHtml = jobsHtml + jobs[xx].getField(opensocial.Organization.Field.FIELD) + '<br />';
}
if (env.supportsField(opensocial.Environment.ObjectType.ORGANIZATION, opensocial.Organization.Field.SALARY)) {
jobsHtml = jobsHtml + '<h3>opensocial.Organization.Field.SALARY</h3>';
jobsHtml = jobsHtml + jobs[xx].getField(opensocial.Organization.Field.SALARY) + '<br />';
}
if (env.supportsField(opensocial.Environment.ObjectType.ORGANIZATION, opensocial.Organization.Field.START_DATE)) {
jobsHtml = jobsHtml + '<h3>opensocial.Organization.Field.START_DATE</h3>';
jobsHtml = jobsHtml + jobs[xx].getField(opensocial.Organization.Field.START_DATE) + '<br />';
}
if (env.supportsField(opensocial.Environment.ObjectType.ORGANIZATION, opensocial.Organization.Field.SUB_FIELD)) {
jobsHtml = jobsHtml + '<h3>opensocial.Organization.Field.SUB_FIELD</h3>';
jobsHtml = jobsHtml + jobs[xx].getField(opensocial.Organization.Field.SUB_FIELD) + '<br />';
}
if (env.supportsField(opensocial.Environment.ObjectType.ORGANIZATION, opensocial.Organization.Field.TITLE)) {
jobsHtml = jobsHtml + '<h3>opensocial.Organization.Field.TITLE</h3>';
jobsHtml = jobsHtml + jobs[xx].getField(opensocial.Organization.Field.TITLE) + '<br />';
}
if (env.supportsField(opensocial.Environment.ObjectType.ORGANIZATION, opensocial.Organization.Field.WEBPAGE)) {
jobsHtml = jobsHtml + '<h3>opensocial.Organization.Field.WEBPAGE</h3>';
jobsHtml = jobsHtml + jobs[xx].getField(opensocial.Organization.Field.WEBPAGE) + '<br />';
}
}
}
else {
jobsHtml = jobsHtml + 'UNDEFINED<br />';
}
document.getElementById('view_JOBS').innerHTML = jobsHtml;
}
if (env.supportsField(opensocial.Environment.ObjectType.PERSON, opensocial.Person.Field.JOB_INTEREST)) {
var jobInterests = data.getField(opensocial.Person.Field.JOB_INTERESTS);
var jobInterestsHtml = '<h2>opensocial.Person.Field.JOB_INTERESTS</h2><br />';
if (jobInterests) {
jobInterestsHtml = jobInterestsHtml + jobInterests + '<br />';
}
else {
jobInterestsHtml = jobInterestsHtml + 'UNDEFINED<br />';
}
document.getElementById('view_JOB_INTERESTS').innerHTML = jobInterestsHtml;

}
if (env.supportsField(opensocial.Environment.ObjectType.PERSON, opensocial.Person.Field.SCHOOLS)) {
var schools = data.getField(opensocial.Person.Field.SCHOOLS);
var schoolsHtml = '<h2>opensocial.Person.Field.SCHOOLS</h2><br />';
if (schools) {
for (xx in schools) {
if (env.supportsField(opensocial.Environment.ObjectType.ORGANIZATION, opensocial.Organization.Field.NAME)) {
schoolsHtml = schoolsHtml + '<h3>opensocial.Organization.Field.NAME</h3>';
schoolsHtml = schoolsHtml + schools[xx].getField(opensocial.Organization.Field.NAME) + '<br />';
}
if (env.supportsField(opensocial.Environment.ObjectType.ORGANIZATION, opensocial.Organization.Field.ADDRESS)) {
var address = schools[xx].getField(opensocial.Organization.Field.ADDRESS);
schoolsHtml = schoolsHtml + '<h3>opensocial.Organization.Field.ADDRESS</h3>';

if (address) {
if (env.supportsField(opensocial.Environment.ObjectType.ADDRESS, opensocial.Address.Field.COUNTRY)) {
schoolsHtml = schoolsHtml + '<h4>opensocial.Address.Field.COUNTRY</h4>';
schoolsHtml = schoolsHtml + address.getField(opensocial.Address.Field.COUNTRY) + '<br />';
}
if (env.supportsField(opensocial.Environment.ObjectType.ADDRESS, opensocial.Address.Field.EXTENDED_ADDRESS)) {
schoolsHtml = schoolsHtml + '<h4>opensocial.Address.Field.EXTENDED_ADDRESS</h4>';
schoolsHtml = schoolsHtml + address.getField(opensocial.Address.Field.EXTENDED_ADDRESS) + '<br />';
}
if (env.supportsField(opensocial.Environment.ObjectType.ADDRESS, opensocial.Address.Field.LATITUDE)) {
schoolsHtml = schoolsHtml + '<h4>opensocial.Address.Field.LATITUDE</h4>';
schoolsHtml = schoolsHtml + address.getField(opensocial.Address.Field.LATITUDE) + '<br />';
}
if (env.supportsField(opensocial.Environment.ObjectType.ADDRESS, opensocial.Address.Field.LOCALITY)) {
schoolsHtml = schoolsHtml + '<h4>opensocial.Address.Field.LOCALITY</h4>';
schoolsHtml = schoolsHtml + address.getField(opensocial.Address.Field.LOCALITY) + '<br />';
}
if (env.supportsField(opensocial.Environment.ObjectType.ADDRESS, opensocial.Address.Field.LONGITUDE)) {
schoolsHtml = schoolsHtml + '<h4>opensocial.Address.Field.LONGITUDE</h4>';
schoolsHtml = schoolsHtml + address.getField(opensocial.Address.Field.LONGITUDE) + '<br />';
}
if (env.supportsField(opensocial.Environment.ObjectType.ADDRESS, opensocial.Address.Field.PO_BOX)) {
schoolsHtml = schoolsHtml + '<h4>opensocial.Address.Field.PO_BOX</h4>';
schoolsHtml = schoolsHtml + address.getField(opensocial.Address.Field.PO_BOX) + '<br />';
}
if (env.supportsField(opensocial.Environment.ObjectType.ADDRESS, opensocial.Address.Field.POSTAL_CODE)) {
schoolsHtml = schoolsHtml + '<h4>opensocial.Address.Field.POSTAL_CODE</h4>';
schoolsHtml = schoolsHtml + address.getField(opensocial.Address.Field.POSTAL_CODE) + '<br />';
}
if (env.supportsField(opensocial.Environment.ObjectType.ADDRESS, opensocial.Address.Field.REGION)) {
schoolsHtml = schoolsHtml + '<h4>opensocial.Address.Field.REGION</h4>';
schoolsHtml = schoolsHtml + address.getField(opensocial.Address.Field.REGION) + '<br />';
}
if (env.supportsField(opensocial.Environment.ObjectType.ADDRESS, opensocial.Address.Field.STREET_ADDRESS)) {
schoolsHtml = schoolsHtml + '<h4>opensocial.Address.Field.STREET_ADDRESS</h4>';
schoolsHtml = schoolsHtml + address.getField(opensocial.Address.Field.STREET_ADDRESS) + '<br />';
}
if (env.supportsField(opensocial.Environment.ObjectType.ADDRESS, opensocial.Address.Field.TYPE)) {
schoolsHtml = schoolsHtml + '<h4>opensocial.Address.Field.TYPE</h4>';
schoolsHtml = schoolsHtml + address.getField(opensocial.Address.Field.TYPE) + '<br />';
}
if (env.supportsField(opensocial.Environment.ObjectType.ADDRESS, opensocial.Address.Field.UNSTRUCTURED_ADDRESS)) {
schoolsHtml = schoolsHtml + '<h4>opensocial.Address.Field.UNSTRUCTURED_ADDRESS</h4>';
schoolsHtml = schoolsHtml + address.getField(opensocial.Address.Field.UNSTRUCTURED_ADDRESS) + '<br />';
}
}
}
if (env.supportsField(opensocial.Environment.ObjectType.ORGANIZATION, opensocial.Organization.Field.DESCRIPTION)) {
schoolsHtml = schoolsHtml + '<h3>opensocial.Organization.Field.DESCRIPTION</h3>';
schoolsHtml = schoolsHtml + schools[xx].getField(opensocial.Organization.Field.DESCRIPTION) + '<br />';
}
if (env.supportsField(opensocial.Environment.ObjectType.ORGANIZATION, opensocial.Organization.Field.END_DATE)) {
schoolsHtml = schoolsHtml + '<h3>opensocial.Organization.Field.END_DATE</h3>';
schoolsHtml = schoolsHtml + schools[xx].getField(opensocial.Organization.Field.END_DATE) + '<br />';
}
if (env.supportsField(opensocial.Environment.ObjectType.ORGANIZATION, opensocial.Organization.Field.FIELD)) {
schoolsHtml = schoolsHtml + '<h3>opensocial.Organization.Field.FIELD</h3>';
schoolsHtml = schoolsHtml + schools[xx].getField(opensocial.Organization.Field.FIELD) + '<br />';
}
if (env.supportsField(opensocial.Environment.ObjectType.ORGANIZATION, opensocial.Organization.Field.SALARY)) {
schoolsHtml = schoolsHtml + '<h3>opensocial.Organization.Field.SALARY</h3>';
schoolsHtml = schoolsHtml + schools[xx].getField(opensocial.Organization.Field.SALARY) + '<br />';
}
if (env.supportsField(opensocial.Environment.ObjectType.ORGANIZATION, opensocial.Organization.Field.START_DATE)) {
schoolsHtml = schoolsHtml + '<h3>opensocial.Organization.Field.START_DATE</h3>';
schoolsHtml = schoolsHtml + schools[xx].getField(opensocial.Organization.Field.START_DATE) + '<br />';
}
if (env.supportsField(opensocial.Environment.ObjectType.ORGANIZATION, opensocial.Organization.Field.SUB_FIELD)) {
schoolsHtml = schoolsHtml + '<h3>opensocial.Organization.Field.SUB_FIELD</h3>';
schoolsHtml = schoolsHtml + schools[xx].getField(opensocial.Organization.Field.SUB_FIELD) + '<br />';
}
if (env.supportsField(opensocial.Environment.ObjectType.ORGANIZATION, opensocial.Organization.Field.TITLE)) {
schoolsHtml = schoolsHtml + '<h3>opensocial.Organization.Field.TITLE</h3>';
schoolsHtml = schoolsHtml + schools[xx].getField(opensocial.Organization.Field.TITLE) + '<br />';
}
if (env.supportsField(opensocial.Environment.ObjectType.ORGANIZATION, opensocial.Organization.Field.WEBPAGE)) {
schoolsHtml = schoolsHtml + '<h3>opensocial.Organization.Field.WEBPAGE</h3>';
schoolsHtml = schoolsHtml + schools[xx].getField(opensocial.Organization.Field.WEBPAGE) + '<br />';
}
}
}
else {
schoolsHtml = schoolsHtml + 'UNDEFINED<br />';
}
document.getElementById('view_SCHOOLS').innerHTML = schoolsHtml;
}
if (env.supportsField(opensocial.Environment.ObjectType.PERSON, opensocial.Person.Field.INTERESTS)) {
var interests = data.getField(opensocial.Person.Field.INTERESTS);
var interestsHtml = '<h2>opensocial.Person.Field.INTERESTS</h2><br />';
if (interests) {
interestsHtml = interestsHtml + interests + '<br />';
}
else {
interestsHtml = interestsHtml + 'UNDEFINED<br />';
}
document.getElementById('view_INTERESTS').innerHTML = interestsHtml;

}
if (env.supportsField(opensocial.Environment.ObjectType.PERSON, opensocial.Person.Field.URLS)) {
var urls = data.getField(opensocial.Person.Field.URLS);
var urlsHtml = '<h2>opensocial.Person.Field.URLS</h2><br />';
if (urls) {
for (xx in urls) {
if (env.supportsField(opensocial.Environment.ObjectType.URL, opensocial.Url.Field.ADDRESS)) {
urlsHtml = urlsHtml + '<h3>opensocial.Url.Field.ADDRESS</h3><br />';
urlsHtml = urlsHtml + urls[xx].getField(opensocial.Url.Field.ADDRESS) + '<br />';
}
if (env.supportsField(opensocial.Environment.ObjectType.URL, opensocial.Url.Field.LINK_TEXT)) {
urlsHtml = urlsHtml + '<h3>opensocial.Url.Field.LINK_TEXT</h3><br />';
urlsHtml = urlsHtml + urls[xx].getField(opensocial.Url.Field.LINK_TEXT) + '<br />';
}
if (env.supportsField(opensocial.Environment.ObjectType.URL, opensocial.Url.Field.TYPE)) {
urlsHtml = urlsHtml + '<h3>opensocial.Url.Field.TYPE</h3><br />';
urlsHtml = urlsHtml + urls[xx].getField(opensocial.Url.Field.TYPE) + '<br />';
}
}
}
else {
urlsHtml = urlsHtml + 'UNDEFINED<br />';
}
document.getElementById('view_URLS').innerHTML = urlsHtml;
}
if (env.supportsField(opensocial.Environment.ObjectType.PERSON, opensocial.Person.Field.MUSIC)) {
var music = data.getField(opensocial.Person.Field.MUSIC);
var musicHtml = '<h2>opensocial.Person.Field.MUSIC</h2><br />';
if (music) {
for (xx in music) {
musicHtml = musicHtml + music[xx] + '<br />';
}
}
else {
musicHtml = musicHtml + 'UNDEFINED<br />';
}
document.getElementById('view_MUSIC').innerHTML = musicHtml;
}
if (env.supportsField(opensocial.Environment.ObjectType.PERSON, opensocial.Person.Field.MOVIES)) {
var movie = data.getField(opensocial.Person.Field.MOVIES);
var movieHtml = '<h2>opensocial.Person.Field.MOVIES</h2><br />';
if (movie) {
for (xx in movie) {
movieHtml = movieHtml + movie[xx] + '<br />';
}
}
else {
movieHtml = movieHtml + 'UNDEFINED<br />';
}
document.getElementById('view_MOVIES').innerHTML = movieHtml;
}
if (env.supportsField(opensocial.Environment.ObjectType.PERSON, opensocial.Person.Field.TV_SHOWS)) {
var tvShow = data.getField(opensocial.Person.Field.TV_SHOWS);
var tvShowHtml = '<h2>opensocial.Person.Field.TV_SHOWS</h2><br />';
if (tvShow) {
for (xx in tvShow) {
tvShowHtml = tvShowHtml + tvShow[xx] + '<br />';
}
}
else {
tvShowHtml = tvShowHtml + 'UNDEFINED<br />';
}
document.getElementById('view_TV_SHOWS').innerHTML = tvShowHtml;
}
if (env.supportsField(opensocial.Environment.ObjectType.PERSON, opensocial.Person.Field.BOOKS)) {
var book = data.getField(opensocial.Person.Field.BOOKS);
var bookHtml = '<h2>opensocial.Person.Field.BOOKS</h2><br />';
if (book) {
for (xx in book) {
bookHtml = bookHtml + book[xx] + '<br />';
}
}
else {
bookHtml = bookHtml + 'UNDEFINED<br />';
}
document.getElementById('view_BOOKS').innerHTML = bookHtml;
}
if (env.supportsField(opensocial.Environment.ObjectType.PERSON, opensocial.Person.Field.ACTIVITIES)) {
var activities = data.getField(opensocial.Person.Field.ACTIVITIES);
var activitiesHtml = '<h2>opensocial.Person.Field.ACTIVITIES</h2><br />';
if (activities) {
for (xx in activities) {
activitiesHtml = activitiesHtml + activities[xx] + '<br />';
}
}
else {
activitiesHtml = activitiesHtml + 'UNDEFINED<br />';
}
document.getElementById('view_ACTIVITIES').innerHTML = activitiesHtml;
}
if (env.supportsField(opensocial.Environment.ObjectType.PERSON, opensocial.Person.Field.SPORTS)) {
var sports = data.getField(opensocial.Person.Field.SPORTS);
var sportsHtml = '<h2>opensocial.Person.Field.SPORTS</h2><br />';
if (sports) {
for (xx in sports) {
sportsHtml = sportsHtml + sports[xx] + '<br />';
}
}
else {
sportsHtml = sportsHtml + 'UNDEFINED<br />';
}
document.getElementById('view_SPORTS').innerHTML = sportsHtml;
}
if (env.supportsField(opensocial.Environment.ObjectType.PERSON, opensocial.Person.Field.HEROES)) {
var heroes = data.getField(opensocial.Person.Field.HEROES);
var heroesHtml = '<h2>opensocial.Person.Field.HEROES</h2><br />';
if (heroes) {
for (xx in heroes) {
heroesHtml = heroesHtml + heroes[xx] + '<br />';
}
}
else {
heroesHtml = heroesHtml + 'UNDEFINED<br />';
}
document.getElementById('view_HEROES').innerHTML = heroesHtml;
}
if (env.supportsField(opensocial.Environment.ObjectType.PERSON, opensocial.Person.Field.QUOTES)) {
var quotes = data.getField(opensocial.Person.Field.QUOTES);
var quotesHtml = '<h2>opensocial.Person.Field.QUOTES</h2><br />';
if (quotes) {
for (xx in quotes) {
quotesHtml = quotesHtml + quotes[xx] + '<br />';
}
}
else {
quotesHtml = quotesHtml + 'UNDEFINED<br />';
}
document.getElementById('view_QUOTES').innerHTML = quotesHtml;
}
if (env.supportsField(opensocial.Environment.ObjectType.PERSON, opensocial.Person.Field.CARS)) {
var cars = data.getField(opensocial.Person.Field.CARS);
var carsHtml = '<h2>opensocial.Person.Field.CARS</h2><br />';
if (cars) {
for (xx in cars) {
carsHtml = carsHtml + cars[xx] + '<br />';
}
}
else {
carsHtml = carsHtml + 'UNDEFINED<br />';
}
document.getElementById('view_CARS').innerHTML = carsHtml;
}
if (env.supportsField(opensocial.Environment.ObjectType.PERSON, opensocial.Person.Field.FOOD)) {
var food = data.getField(opensocial.Person.Field.FOOD);
var foodHtml = '<h2>opensocial.Person.Field.FOOD</h2><br />';
if (food) {
for (xx in food) {
foodHtml = foodHtml + food[xx] + '<br />';
}
}
else {
foodHtml = foodHtml + 'UNDEFINED<br />';
}
document.getElementById('view_FOOD').innerHTML = foodHtml;
}
if (env.supportsField(opensocial.Environment.ObjectType.PERSON, opensocial.Person.Field.TURN_ONS)) {
var turnOns = data.getField(opensocial.Person.Field.TURN_ONS);
var turnOnsHtml = '<h2>opensocial.Person.Field.TURN_ONS</h2><br />';
if (turnOns) {
for (xx in turnOns) {
turnOnsHtml = turnOnsHtml + turnOns[xx] + '<br />';
}
}
else {
turnOnsHtml = turnOnsHtml + 'UNDEFINED<br />';
}
document.getElementById('view_TURN_ONS').innerHTML = turnOnsHtml;
}
if (env.supportsField(opensocial.Environment.ObjectType.PERSON, opensocial.Person.Field.TURN_OFFS)) {
var turnOffs = data.getField(opensocial.Person.Field.TURN_OFFS);
var turnOffsHtml = '<h2>opensocial.Person.Field.TURN_OFFS</h2><br />';
if (turnOffs) {
for (xx in turnOffs) {
turnOffsHtml = turnOffsHtml + turnOffs[xx] + '<br />';
}
}
else {
turnOffsHtml = turnOffsHtml + 'UNDEFINED<br />';
}
document.getElementById('view_TURN_OFFS').innerHTML = turnOffsHtml;
}
if (env.supportsField(opensocial.Environment.ObjectType.PERSON, opensocial.Person.Field.TAGS)) {
var tags = data.getField(opensocial.Person.Field.TAGS);
var tagsHtml = '<h2>opensocial.Person.Field.TAGS</h2><br />';
if (tags) {
for (xx in tags) {
tagsHtml = tagsHtml + tags[xx] + '<br />';
}
}
else {
tagsHtml = tagsHtml + 'UNDEFINED<br />';
}
document.getElementById('view_TAGS').innerHTML = tagsHtml;
}
if (env.supportsField(opensocial.Environment.ObjectType.PERSON, opensocial.Person.Field.ROMANCE)) {
var romance = data.getField(opensocial.Person.Field.ROMANCE);
var romanceHtml = '<h2>opensocial.Person.Field.ROMANCE</h2><br />';
if (romance) {
romanceHtml = romanceHtml + romance + '<br />';
}
else {
romanceHtml = romanceHtml + 'UNDEFINED<br />';
}
document.getElementById('view_ROMANCE').innerHTML = romanceHtml;
}
if (env.supportsField(opensocial.Environment.ObjectType.PERSON, opensocial.Person.Field.SCARED_OF)) {
var scaredOf = data.getField(opensocial.Person.Field.SCARED_OF);
var scaredOfHtml = '<h2>opensocial.Person.Field.SCARED_OF</h2><br />';
if (scaredOf) {
scaredOfHtml = scaredOfHtml + scaredOf + '<br />';
}
else {
scaredOfHtml = scaredOfHtml + 'UNDEFINED<br />';
}
document.getElementById('view_SCARED_OF').innerHTML = scaredOfHtml;
}
if (env.supportsField(opensocial.Environment.ObjectType.PERSON, opensocial.Person.Field.HAPPIEST_WHEN)) {
var happiestWhen = data.getField(opensocial.Person.Field.HAPPIEST_WHEN);
var happiestWhenHtml = '<h2>opensocial.Person.Field.HAPPIEST_WHEN</h2><br />';
if (happiestWhen) {
happiestWhenHtml = happiestWhenHtml + happiestWhen + '<br />';
}
else {
happiestWhenHtml = happiestWhenHtml + 'UNDEFINED<br />';
}
document.getElementById('view_HAPPIEST_WHEN').innerHTML = happiestWhenHtml;
}
if (env.supportsField(opensocial.Environment.ObjectType.PERSON, opensocial.Person.Field.FASHION)) {
var fashion = data.getField(opensocial.Person.Field.FASHION);
var fashionHtml = '<h2>opensocial.Person.Field.FASHION</h2><br />';
if (fashion) {
fashionHtml = fashionHtml + fashion + '<br />';
}
else {
fashionHtml = fashionHtml + 'UNDEFINED<br />';
}
document.getElementById('view_FASHION').innerHTML = fashionHtml;

}
if (env.supportsField(opensocial.Environment.ObjectType.PERSON, opensocial.Person.Field.HUMOR)) {
var humor = data.getField(opensocial.Person.Field.HUMOR);
var humorHtml = '<h2>opensocial.Person.Field.HUMOR</h2><br />';
if (humor) {
humorHtml = humorHtml + humor + '<br />';
}
else {
humorHtml = humorHtml + 'UNDEFINED<br />';
}
document.getElementById('view_HUMOR').innerHTML = humorHtml;
}
if (env.supportsField(opensocial.Environment.ObjectType.PERSON, opensocial.Person.Field.LOOKING_FOR)) {
var lookingFor = data.getField(opensocial.Person.Field.LOOKING_FOR);
var lookingForHtml = '<h2>opensocial.Person.Field.LOOKING_FOR</h2><br />';
if (lookingFor) {
for (xx in lookingFor) {
if (lookingFor[xx]) {
lookingForHtml = lookingForHtml + lookingFor[xx].getDisplayValue() + '<br />';
}
}
}
else {
lookingForHtml = lookingForHtml + 'UNDEFINED<br />';
}
document.getElementById('view_LOOKING_FOR').innerHTML = lookingForHtml;
}
if (env.supportsField(opensocial.Environment.ObjectType.PERSON, opensocial.Person.Field.RELIGION)) {
var religion = data.getField(opensocial.Person.Field.RELIGION);
var religionHtml = '<h2>opensocial.Person.Field.RELIGION</h2><br />';
if (religion) {
religionHtml = religionHtml + religion + '<br />';
}
else {
religionHtml = religionHtml + 'UNDEFINED<br />';
}
document.getElementById('view_RELIGION').innerHTML = religionHtml;
}
if (env.supportsField(opensocial.Environment.ObjectType.PERSON, opensocial.Person.Field.POLITICAL_VIEWS)) {
var politicalViews = data.getField(opensocial.Person.Field.POLITICAL_VIEWS);
var politicalViewsHtml = '<h2>opensocial.Person.Field.POLITICAL_VIEWS</h2><br />';
if (politicalViews) {
politicalViewsHtml = politicalViewsHtml + politicalViews + '<br />';
}
else {
politicalViewsHtml = politicalViewsHtml + 'UNDEFINED<br />';
}
document.getElementById('view_POLITICAL_VIEWS').innerHTML = politicalViewsHtml;

}
if (env.supportsField(opensocial.Environment.ObjectType.PERSON, opensocial.Person.Field.HAS_APP)) {
var hasApp = data.getField(opensocial.Person.Field.HAS_APP);
var hasAppHtml = '<h2>opensocial.Person.Field.HAS_APP</h2><br />';
if (hasApp) {
hasAppHtml = hasAppHtml + hasApp + '<br />';
}
else {
hasAppHtml = hasAppHtml + 'UNDEFINED<br />';
}
document.getElementById('view_HAS_APP').innerHTML = hasAppHtml;

}
if (env.supportsField(opensocial.Environment.ObjectType.PERSON, opensocial.Person.Field.NETWORK_PRESENCE)) {
var networkPresence = data.getField(opensocial.Person.Field.NETWORK_PRESENCE);
var networkPresenceHtml = '<h2>opensocial.Person.Field.NETWORK_PRESENCE</h2><br />';
if (networkPresence) {
networkPresenceHtml = networkPresenceHtml + networkPresence.getDisplayValue() + '<br />';
}
else {
networkPresenceHtml = networkPresenceHtml + 'UNDEFINED<br />';
}
document.getElementById('view_NETWORK_PRESENCE').innerHTML = networkPresenceHtml;

}

// 自動調節
gadgets.window.adjustHeight();
};

gadgets.util.registerOnLoadHandler(requestGetOwnerProfile);

</script>
<div id='view_ID'></div>
<div id='view_NAME'></div>
<div id='view_NICKNAME'></div>
<div id='view_THUMBNAIL_URL'></div>
<div id='view_PROFILE_URL'></div>
<div id='view_CURRENT_LOCATION'></div>
<div id='view_ADDRESSES'></div>
<div id='view_EMAILS'></div>
<div id='view_PHONE_NUMBERS'></div>
<div id='view_ABOUT_ME'></div>
<div id='view_STATUS'></div>
<div id='view_PROFILE_SONG'></div>
<div id='view_PROFILE_VIDEO'></div>
<div id='view_GENDER'></div>
<div id='view_SEXUAL_ORIENTATION'></div>
<div id='view_RELATIONSHIP_STATUS'></div>
<div id='view_AGE'></div>
<div id='view_DATE_OF_BIRTH'></div>
<div id='view_BODY_TYPE'></div>
<div id='view_ETHNICITY'></div>
<div id='view_SMOKER'></div>
<div id='view_DRINKER'></div>
<div id='view_CHILDREN'></div>
<div id='view_PETS'></div>
<div id='view_LIVING_ARRANGEMENT'></div>
<div id='view_TIME_ZONE'></div>
<div id='view_LANGUAGES_SPOKEN'></div>
<div id='view_JOBS'></div>
<div id='view_JOB_INTERESTS'></div>
<div id='view_SCHOOLS'></div>
<div id='view_INTERESTS'></div>
<div id='view_URLS'></div>
<div id='view_MUSIC'></div>
<div id='view_MOVIES'></div>
<div id='view_TV_SHOWS'></div>
<div id='view_BOOKS'></div>
<div id='view_ACTIVITIES'></div>
<div id='view_SPORTS'></div>
<div id='view_HEROES'></div>
<div id='view_QUOTES'></div>
<div id='view_CARS'></div>
<div id='view_FOOD'></div>
<div id='view_TURN_ONS'></div>
<div id='view_TURN_OFFS'></div>
<div id='view_TAGS'></div>
<div id='view_ROMANCE'></div>
<div id='view_SCARED_OF'></div>
<div id='view_HAPPIEST_WHEN'></div>
<div id='view_FASHION'></div>
<div id='view_HUMOR'></div>
<div id='view_LOOKING_FOR'></div>
<div id='view_RELIGION'></div>
<div id='view_POLITICAL_VIEWS'></div>
<div id='view_HAS_APP'></div>
<div id='view_NETWORK_PRESENCE'></div>
]]>
</Content>
</Module>




えらく疲れた。。。
コード出力にはFireBugのconsole.logを使った。。
けど、、ねぇ。。

.

[Apache Shindig][お勉強][OpenSocial] メモ54 container.jsでPersonオブジェクトの全項目をsupported

あほっぽいけど、Personオブジェクトの全項目をShindigで"supported"にするための、
container.jsのsupportedFields。


"opensocial-0.8" : {
"path" : "http://%host%/social",
"domain" : "qsdn.co.jp",
"enableCaja" : false,
"supportedFields" : {
"person" : [
"id",
"name",
"nickname",
"thumbnailUrl",
"profileUrl",
"currentLocation",
"addresses",
"emails",
"phoneNumbers",
"aboutMe",
"status",
"profileSong",
"profileVideo",
"gender",
"sexualOrientation",
"relationshipStatus",
"age",
/* birthday, dateOfBirthは同じもの */
"birthday",
"dateOfBirth",
"bodyType",
"ethnicity",
"smoker",
"drinker",
"children",
"pets",
"livingArrangement",
/* timeZone, utcOffsetは同じもの */
"timeZone",
"utcOffset",
"languagesSpoken",
/* organizations, jobs, schoolsは同じもの */
"organizations",
"jobs",
"jobInterests",
"schools",
"interests",
"urls",
"music",
"movies",
"tvShows",
"books",
"activities",
"sports",
"heroes",
"quotes",
"cars",
"food",
"turnOns",
"turnOffs",
"tags",
"romance",
"scaredOf",
"happiestWhen",
"fashion",
"humor",
"lookingFor",
"religion",
"politicalViews",
"hasApp",
"networkPresence"
],
"name" : [
"familyName",
"givenName",
"additionalName",
"honorificPrefix",
"honorificSuffix",
"unstructured"
],
"address" : [
"type",
"unstructuredAddress",
"poBox",
"streetAddress",
"extendedAddress",
"region",
"locality",
"postalCode",
"country",
"latitude",
"longitude"
],
"organization" : [
"name",
"title",
"description",
"field",
"subField",
"startDate",
"endDate",
"salary",
"address",
"webpage"
],
"url" : [
"type",
"linkText",
"address"
],
"email" : [
"type",
"address"
],
"phone" : [
"type",
"number"
],
"bodyType" : [
"build",
"height",
"weight",
"eyeColor",
"hairColor"
],
"activity" : ["id", "title"]

}
},



ちなみに、FireBug使った。

.

[Apache Shindig][お勉強][OpenSocial] メモ53 container.jsで定義した値を使ってJava側supportsField()を実装してみる

JavaScript APIでは、opensocial.getEnvironment().supportsField()
というメソッドが用意されているが、ここで元となるsupportedField(多分container.jsで定義)
を使って、Java側でsupportsFieldをやってみた。

container.jsで定義された値は、
ContainerConfigというクラスに保存されているので、そこからsupportedFieldを取得する。
取得したsupportedFieldをひとつひとつ見ていって、サポートしているかどうか判断する。

で、コードはこんな感じ。


public boolean supportsField(String container, String objectName, String fieldTree) {
assert fieldTree != null;
assert objectName != null;
assert container != null;

if (logger.isDebugEnabled()) {
logger.debug("サポートチェック開始:"
+ "objectName:[" + objectName + "]:"
+ "fieldTree:[" + fieldTree + "]:"
);
}

String jsonString = "${Cur['gadgets.features']['opensocial-0.8'].supportedFields." + objectName + "}";
String[] field = null;
if (fieldTree.indexOf(".")!= -1) {
field = fieldTree.split("\\.");
}
else {
field = new String[1];
field[0] = fieldTree;
}
List<Object> supportedFieldList = containerConfig.getList(container, jsonString);
for (int ii=0,length = field.length; ii<length; ii++) {
for (Object obj: supportedFieldList) {
if (obj instanceof String) {
if (field[ii].equals(obj)) {
if (logger.isDebugEnabled()) {
logger.debug("サポートチェック終了:対応(String):"
+ "objectName:[" + objectName + "]:"
+ "fieldTree:[" + fieldTree + "]:"
);
}
return true;
}
}
else if (obj instanceof ImmutableMap) {
ImmutableMap map = (ImmutableMap) obj;
List<Object> tmp = (List<Object>)map.get(field[ii]);
if (tmp != null) {
if (ii == length - 1) {
if (logger.isDebugEnabled()) {
logger.debug("サポートチェック終了:対応(Map):"
+ "objectName:[" + objectName + "]:"
+ "fieldTree:[" + fieldTree + "]:"
);
}
return true;
}
supportedFieldList = tmp;
break;
}
}
else {
assert false;
}
}
}
if (logger.isDebugEnabled()) {
logger.debug("サポートチェック終了:非対応:"
+ "objectName:[" + objectName + "]:"
+ "fieldTree:[" + fieldTree + "]:"
);
}
return false;
}


containerConfigはプロパティとして、Injectされているものとした。
もっといい方法があるかとは思う。

そもそも、container.jsで記述するサポートする項目は、
既存のSNSなりの項目に合わせるので、Javaから判断する必要は無いっぽい。

一応これで、

if (supportsField(token.getContainer(), "person", Person.Field.ADDRESSES)) {

などと、使用することができる。

ちなみに、Person.Field.NAMEのADDITIONAL_NAMEがサポートされているかどうか、
などといった、ネストした項目もチェック可能。

if (supportsField(token.getContainer(), "person", Person.Field.NAME + "." + Name.Field.ADDTIONAL_NAME)) {

なんてな風にしてみた。


--
なんとなく違う気がする。

Person.Field.NAME + "." + Name.Field.ADDTIONAL_NAME

という部分が独自すぎ。。

container.jsの

"supportedFields" : {
"person" : ["id", {"name" : ["familyName", "givenName", "unstructured"]}, "thumbnailUrl", "profileUrl"],
"activity" : ["id", "title"]
}

を、

"supportedFields" : {
"person" : ["id", "name", "thumbnailUrl", "profileUrl"],
"name" : ["familyName", "givenName", "unstructured"],
"activity" : ["id", "title"]
}

として、

if (supportsField(token.getContainer(), "name", Name.Field.ADDTIONAL_NAME)) {

なんてした方がいいような気がする。

.

[mod_chxj][携帯][deviceatlas] deviceatlas徘徊中

deviceatlasというサイトを、
http://sourceforge.jp/forum/forum.php?thread_id=23365&forum_id=6550
で教えてもらった。

googleで調べると、結構有名っぽい?

早速freeユーザ登録して、サイト内を徘徊中。

.

[OpenSocial][その他] 日本でのOpenSocial

日本でのOpenSocialで名があるところは、、

mixi
NTTレゾナント

あたりですかねー。

有名人は、

田中よういちろうさん
えーじさん

あたりですかねー。

mixiとGoo独占状態っぽい。

OpenPNEの方々はどうなんだろうか。。

調べてみようっと。
.

[Apache Shindig][お勉強][OpenSocial] メモ52 container.jsで定義した値をJavaから取得

container.jsで定義した設定をJavaで取得する。

必要なクラスは、


org.apache.shindig.config.ContainerConfig



で、たとえば、
gadgets.featuresのcore.ioがほしければ、


import org.apache.shindig.config.ContainerConfig;
import com.google.inject.Inject;
import java.util.Map;

public Aaa {

private ContainerConfig containerConfig;

@Inject
public Aaa(ContainerConfig containerConfig) {
this.containerConfig = containerConfig;
}

public proc() {
Map<String, Object> coreIo = containerConfig.getMap("default", "gadgets.features").get("core.io");

for (String key : coreIo) {
System.out.println("key:[" + key + "]");
}
}
}


なんて感じで取れる。もちろん上記はあくまでイメージ。
containerConfig.getMapの第一引数はコンテナ名。
Shindigデフォルトだと"default"になっている。

そんだけ。
.

2009年7月17日金曜日

[Apache Shindig][お勉強][OpenSocial] メモ51 opensocial.Person.Field.PROFILE_URL

opensocial.newFetchPersonRequest使って、全項目取得すると、
サーバ側でセットしていないはずの
opensocial.Person.Field.URLS
が取得できてしまう。
どんな値が入っているかというと、
opensocial.Person.Field.PROFILE_URL
でセットした値。

なんでかと思って、ソース見てみた。
すると、org.apache.shindig.social.core.model.PersonImplに、


public String getProfileUrl() {
Url url = getListFieldWithType(PROFILE_URL_TYPE, getUrls());
return url == null ? null : url.getValue();
}

public void setProfileUrl(String profileUrl) {
Url url = getListFieldWithType(PROFILE_URL_TYPE, getUrls());
if (url != null) {
url.setValue(profileUrl);
} else {
setUrls(addListField(new UrlImpl(profileUrl, null, PROFILE_URL_TYPE), getUrls()));
}
}


とsetProfileUrlメソッドはなっていて、さらに、
getUrlsは、

public List<Url> getUrls() {
return urls;
}


となっている。

ほっほぅ。
なるほど。

でも、setUrlsを見てみると、、

public void setUrls(List<Url> urls) {
this.urls = urls;
}


となっているんで、
setProfileUrlをコールした後に、setUrlsをコールしてしまうと、
setProfileUrlでセットした値がどっかへいってしまう。。

PersonImplをオリジナルで実装するか、もしくは、
setProfileUrlを必ずsetUrlsの前でコールしないとだめみたい。

.

[OpenSocial][本] OpenSocial入門

田中よういちろうさんの「OpenSocial入門」という本を買った。

熟読ものです。

.

2009年7月16日木曜日

[Apache Shindig][お勉強][OpenSocial] メモ50 opensocial.newFetchPersonRequest

opensocial.newFetchPersonRequestしてみた。


var params = {};
params[opensocial.DataRequest.PeopleRequestFields.PROFILE_DETAILS] = [
opensocial.Person.Field.ID,
opensocial.Person.Field.NAME,
opensocial.Person.Field.NICKNAME,
opensocial.Person.Field.THUMBNAIL_URL,
opensocial.Person.Field.PROFILE_URL,
opensocial.Person.Field.CURRENT_LOCATION,
opensocial.Person.Field.ADDRESSES,
opensocial.Person.Field.EMAILS,
opensocial.Person.Field.PHONE_NUMBERS,
opensocial.Person.Field.ABOUT_ME,
opensocial.Person.Field.STATUS,
opensocial.Person.Field.PROFILE_SONG,
opensocial.Person.Field.PROFILE_VIDEO,
opensocial.Person.Field.GENDER,
opensocial.Person.Field.SEXUAL_ORIENTATION,
opensocial.Person.Field.RELATIONSHIP_STATUS,
opensocial.Person.Field.AGE,
opensocial.Person.Field.DATE_OF_BIRTH,
opensocial.Person.Field.BODY_TYPE,
opensocial.Person.Field.ETHNICITY,
opensocial.Person.Field.SMOKER,
opensocial.Person.Field.DRINKER,
opensocial.Person.Field.CHILDREN,
opensocial.Person.Field.PETS,
opensocial.Person.Field.LIVING_ARRANGEMENT,
opensocial.Person.Field.TIME_ZONE,
opensocial.Person.Field.LANGUAGES_SPOKEN,
opensocial.Person.Field.JOBS,
opensocial.Person.Field.JOB_INTERESTS,
opensocial.Person.Field.SCHOOLS,
opensocial.Person.Field.INTERESTS,
opensocial.Person.Field.URLS,
opensocial.Person.Field.MUSIC,
opensocial.Person.Field.MOVIES,
opensocial.Person.Field.TV_SHOWS,
opensocial.Person.Field.BOOKS,
opensocial.Person.Field.ACTIVITIES,
opensocial.Person.Field.SPORTS,
opensocial.Person.Field.HEROES,
opensocial.Person.Field.QUOTES,
opensocial.Person.Field.CARS,
opensocial.Person.Field.FOOD,
opensocial.Person.Field.TURN_ONS,
opensocial.Person.Field.TURN_OFFS,
opensocial.Person.Field.TAGS,
opensocial.Person.Field.ROMANCE,
opensocial.Person.Field.SCARED_OF,
opensocial.Person.Field.HAPPIEST_WHEN,
opensocial.Person.Field.FASHION,
opensocial.Person.Field.HUMOR,
opensocial.Person.Field.LOOKING_FOR,
opensocial.Person.Field.RELIGION,
opensocial.Person.Field.POLITICAL_VIEWS,
opensocial.Person.Field.HAS_APP,
opensocial.Person.Field.NETWORK_PRESENCE
];
var req = opensocial.newDataRequest();
req.add(req.newFetchPersonRequest(
opensocial.IdSpec.PersonId.OWNER,
params),
"get_owner");
req.send(handleRequestGetOwnerProfile);

な感じに。
container.jsで定義したはずの

"supportedFields" : {
"person" : ["id", {"name" : ["familyName", "givenName", "unstructured"]}, "thumbnailUrl", "profileUrl"],
"activity" : ["id", "title"]
}

はここでは効いていないようで、リクエストとして指定した項目分、送信される。
サーバ側でも特にチェックしている様子はないので、serviceの実装時にチェックしなきゃいけない
っぽい。

最初、サーバからのレスポンスから、opensocial.Person.Field.JOBSの値が取得できなかった。
opensocial.Organization.Field.TYPEの項目に、jobまたはschoolを指定していなかったため。
opensocial.Organization.Field.TYPEには、
1) job
2) school
のいずれかを文字列として指定していないとダメらしい。

さらに、
opensocial.Organization.Field.ADDRESS
も現状のshindig-1.1(trunk)では、opensocial.Addressオブジェクトとしては
取得できない。

たぶん、開発中または、参照という位置づけなのか、Organization中のAddressはJSONオブジェクトが
そのまま入っている。
それだと、つまらないので、

features/opensocial-reference/organization.js



opensocial.Organization = function(opt_params) {
this.fields_ = opt_params || {};
};



opensocial.Organization = function(opt_params) {
this.fields_ = opt_params || {};
if (this.fields_ && this.fields_["address"] && ! this.fields_["address"].getField) {
this.constructObject(this.fields_, "address", opensocial.Address);
}
};

に書き換え、さらに、その下に

opensocial.Organization.prototype.constructObject = function(map, fieldName, className) {
var fieldValue = map[fieldName];
if (fieldValue) {
map[fieldName] = new className(fieldValue);
}
};

なんてのを、どっかからコピーして追加。

これで一応、Organization.Addressもopensocial.Addressオブジェクトとして
扱える。
JavaScriptは良くわからないので正しいか知らない。

opensocial.Person.Field.JOBSとopensocial.Person.Field.SCHOOLSはともに、
organizationsという名のパラメータでサーバ側に送信される。
だもんで、現状では、両方指定しても無意味。
これはたぶん、

features/opensocial-base/fieldtranslations.js

の、

FieldTranslations.translateJsPersonFieldsToServerFields = function(fields) {
for (var i = 0; i < fields.length; i++) {
if (fields[i] == 'dateOfBirth') {
fields[i] = 'birthday';
} else if (fields[i] == 'timeZone') {
fields[i] = 'utcOffset';
} else if (fields[i] == 'jobs') {
fields[i] = 'organizations';
} else if (fields[i] == 'schools') {
fields[i] = 'organizations';
}
}

// displayName and id always need to be requested
fields.push('id');
fields.push('displayName');
};

らへんぽい。

organizationsの応答には、type='job'、type='school'の両方を入れておけばよいかも。


.

2009年7月15日水曜日

[Apache Shindig][お勉強][OpenSocial] メモ49 opensocial.Address.Field.EXTENDED_ADDRESSとopensocial.Address.Field.POBOX

http://www.opensocial.org/Technical-Resources/opensocial-spec-v09/OpenSocial-Specification.html#opensocial.Address.Field

を見ると、
opensocial.Address.Field.EXTENDED_ADDRESS、
opensocial.Address.Field.POBOX
は存在するらしいんだけど、
shindigのtrunkのjava側のソースにはない。。

まだ実装されていないのかと思いきや、

リビジョン688893で、削除されている。。

これはいったいなんじゃらほい。

--
というか、ちゃんとメッセージに書いてあるじゃん。


the poBox and extendedAddress fields on the address object have been removed. containers should now put that information into streetAddress which can be multiline.

だそうで。
.

2009年7月14日火曜日

[Apache Shindig][お勉強][OpenSocial] メモ48 opensocial.requestPermissionを実装してみた

Shindigデフォルトだと、requestPermissionは必ず


opensocial.ResponseItem.Error.UNAUTHORIZED

が返ってくる。

ちっとも面白くないので、実装してみた。

実装手順は以下のとおり。

1) features/opensocial-jsonrpc/jsonrpccontainer.jsを拡張し、requestPermissionの際はサーバに問い合わせるようにする。
2) サーバ側を実装する。

そんだけ。jsonrpcじゃないけど、とりあえず。
正しい手順かどうかは知らない。

で、jsonrpccontainer.js。

JsonRpcContainer.prototype.requestPermissionUrl_ = 'container/requestPermission.json';
JsonRpcContainer.prototype.requestPermission = function(permissions, reason, opt_callback) {
var ret = {};
var token = shindig.auth.getSecurityToken();
if (window.confirm("ガジェットがあなたのプロフィール情報の使用許可を求めています。\n【理由】" + reason + "\nここで許可するとあなたの全プロフィール情報が利用可能になり
ます。許可しますか?")) {
var parm = {};
parm.permission = permissions;
parm.st = token;
$.ajax({
type: "GET",
url: this.requestPermissionUrl_,
cache: false,
async: false,
data: parm,
dataType: 'json',
success: function(json) {
ret.result = json;
}
});
if (ret.result.errorCode === 'OK') {
opt_callback(new opensocial.ResponseItem(
null, null, null, null));
return;
}
}
opt_callback(new opensocial.ResponseItem(
null, null, opensocial.ResponseItem.Error.UNAUTHORIZED, null));
};


JavaScript要勉強。とりあえずはこんな感じで。

で、Java側。
環境はShindig+SpringFramework2.5(Java)。
まずはコントローラ。

/**
* opensocial.requestPermissionのサーバ側実装.
*
* @author Atsushi Konno(QSDN
*/
public class RequestPermissionController extends AbstractController {

protected final Log logger = LogFactory.getLog(RequestPermissionController.class);
protected String viewName = "";

protected Logic logic;
private HttpUserSessionService session;

protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception {
logger.info("パーミッション要求コントローラ開始");
String[] permissions = RequestUtils.getRequiredStringParameters(request, "permission");

if (logger.isDebugEnabled()) {
for (int ii=0, length = permissions.length; ii<length; ii++) {
logger.info("permission:[" + permissions[ii] + "]");
}
}
SecurityToken token = logic.getSecurityToken(request);
long moduleId = token.getModuleId();

String sessionId = null;
try {
sessionId = session.getId(request);
}
catch (UserSessionTimeOutException utoe) {
}
ModelAndView mav = new ModelAndView(viewName);


if (logic.requestPermission(sessionId, moduleId, permissions)) {
mav.addObject("errorCode", "OK");
}
else {
mav.addObject("errorCode", "NG");
}

logger.info("パーミッション要求コントローラ終了");

return mav;
}


public Logic getLogic() {
return logic;
}
public void setLogic(Logic logic) {
this.logic = logic;
}

/**
* Get viewName.
*
* @return viewName as String.
*/
public String getViewName() {
return viewName;
}

/**
* Set viewName.
*
* @param viewName the value to set.
*/
public void setViewName(String viewName) {
this.viewName = viewName;
}

/**
* Get session.
*
* @return session as HttpUserSessionService.
*/
public HttpUserSessionService getSession() {
return session;
}

/**
* Set session.
*
* @param session the value to set.
*/
public void setSession(HttpUserSessionService session) {
this.session = session;
}
}


とりあえずはこんな感じ。

で、そのJSP。

{
"errorCode": "${errorCode}"
}


そんだけ。

で、本体のlogic。

/**
* opensocial.requestPermissionに対応するサーバ側実装
*
* @param sessionId sessionId
* @param moduleId ガジェットのID
* @param permissions パーミッションの配列
*/
public boolean requestPermission(String sessionId, long moduleId, String[] permissions) throws DataAccessException {
assert sessionId != null;
assert permissions != null && permissions.length == 1;

GmsPerson viewer = getUser();
if (viewer == null) {
if (logger.isDebugEnabled()) {
logger.debug("Guestユーザのため、requestPermissionできない");
}
return false;
}

/*=======================================================================*/
/* ロック */
/*=======================================================================*/
gmsPersonDao.select(viewer.getId(), true);
/*=======================================================================*/
/* すでにrequestPermissionされているか. */
/*=======================================================================*/
for (int ii=0, length = permissions.length; ii<length; ii++) {
try {
gmsSessionPermitDao.selectBySessionIdAndModuleIdAndPermission(sessionId, moduleId, permissions[ii]);
}
catch (ObjectRetrievalFailureException ex) {
GmsSessionPermit permit = new GmsSessionPermit();
permit.setId(UuidGenerator.compress(UuidGenerator.generate()));
permit.setSessionId(sessionId);
permit.setModuleId(moduleId);
permit.setPermission(permissions[ii]);
permit.setCreatedAt(new Timestamp(System.currentTimeMillis()));
gmsSessionPermitDao.insert(permit);
}
}

return true;
}


gmsSessionPermitテーブルは、qurtzなんかで定期的に削除。ログアウトしても削除。
GuestはrequestPermissionしてもなにもしない。
viewerは現在ログイン中のユーザかもしくはGuestユーザ。
viewerがGuestで無い場合は、viewerでロック。

で、動かした。

それっぽく動いた。
そんだけ。

--
ガジェットXMLは、

<?xml version="1.0" encoding="UTF-8"?>
<Module>
<ModulePrefs title="opensocial.requestPermission()">
<Require feature="opensocial-0.8" />
</ModulePrefs>
<Content type="html"><![CDATA[
<h1>opensocial.requestPermission()</h1>
<div id='env'></div>
<script type="text/javascript">

if (opensocial.hasPermission(opensocial.Permission.VIEWER)) {
$('#env').append('<h1>許可されてるよぉーん</h1>');
}
else {
$('#env').append('<h1>許可されてないよーん</h1>');
opensocial.requestPermission([opensocial.Permission.VIEWER],
"なんとなく",
function(/*pensocial.ResponseItem*/res) {
if (res.hadError()) {
switch(res.getErrorCode()) {
case opensocial.ResponseItem.Error.NOT_IMPLEMENTED :
$('#env').append('<h1>NOT IMPLEMENTEDだってさ</h1>');
break;
default:
$('#env').append('<h1>' + res.getErrorMessage() + 'だってさ</h1>');
break;
}
}
else {
$('#env').append('<h1>うまくいったっぽいよーん</h1>');
}
});
}
</script>
]]>
</Content>
</Module>



.