public EcFramework() { Map<String, Object> me = JSObjectAdapter.$properties(this); if (template != null) { Map<String, Object> you = JSObjectAdapter.$properties(template); for (String key : you) { if (JSGlobal.typeof(you.$get(key)) != "function") me.$put(key.replace("@", ""), you.$get(key)); } } }
/** * Method to set Thing description * * @param {String} description * Description to set for its Thing * @memberOf Thing * @method setDescription */ public void setDescription(String description) { if (this.description != null && EcObject.isObject(this.description) && JSObjectAdapter.hasOwnProperty(this.description, "@value")) { Object obj = JSObjectAdapter.$get(this, "description"); JSObjectAdapter.$put(obj, "@value", description); JSObjectAdapter.$put(this, "description", obj); } else { this.description = description; } }
@Override public void $invoke(Object p1) { if (cachingSearch) { JSObjectAdapter.$put(cache, cacheKey, p1); } if (cacheKey != null) { JSObjectAdapter.$properties(fetching).$delete(cacheKey); } me.handleSearchResults((Array<EcRemoteLinkedData>) p1, eachSuccess, success, failure); } }, new Callback1<String>() {
@Override public void $invoke(Object r) { me.hookIdentityManagerContacts((String) JSObjectAdapter.$get(r, "id")); } });
private static EcRemoteLinkedData findBlocking(final String url, final String error, final Object history, final int i) { if (i > repos.$length() || repos.$get(i) == null) { JSObjectAdapter.$properties(fetching).$delete(url); return null; } final EcRepository repo = repos.$get(i); if (((Boolean) JSObjectAdapter.$get(history, repo.selectedServer)) == true) findBlocking(url, error, history, i + 1); JSObjectAdapter.$put(history, repo.selectedServer, true); Array<EcRemoteLinkedData> strings = repo.searchBlocking("@id:\"" + url + "\""); if (strings == null || strings.$length() == 0) return findBlocking(url, error, history, i + 1); else { for (int j = 0; j < strings.$length(); j++) { if (strings.$get(j).id == url) { JSObjectAdapter.$properties(fetching).$delete(url); if (caching) { JSObjectAdapter.$put(cache, url, strings.$get(j)); if (strings.$get(j).id != null) JSObjectAdapter.$put(cache, url, strings.$get(j).id); } return strings.$get(j); } } } return findBlocking(url, error, history, i + 1); }
@Override public void $invoke(String p1) { if (JSObjectAdapter.$get(cache, originalUrl) != null) { JSObjectAdapter.$properties(fetching).$delete(originalUrl); success.$invoke((EcRemoteLinkedData) JSObjectAdapter.$get(cache, originalUrl)); return; } fd.append("signatureSheet", p1); EcRemote.postExpectingObject(finalUrl, null, fd, new Callback1<Object>() { @Override public void $invoke(Object p1) { getHandleData(p1, originalUrl, success, failure, finalUrl); } }, new Callback1<String>() { @Override public void $invoke(String p1) { EcRepository.find(originalUrl, p1, new Object(), 0, success, failure); } }); } }, failure);
public static String getDisplayStringFrom(Object n) { if (n != null && EcArray.isArray(n)) { if (((Array) n).$length() > 0) n = ((Array) n).$get(0); } if (n != null && EcObject.isObject(n) && JSObjectAdapter.hasOwnProperty(n, "@value")) { return (String) JSObjectAdapter.$get(n, "@value"); } return (String) n; }
/** * Converts all the elements of this <tt>Array</tt> to Strings using their toLocaleString method, and concatenate * the resulting Strings by a separator String that has been derived in an implementation-defined locale-specific * way. The result of calling this function is intended to be analogous to the result of <tt>toString()</tt>, except * that the result of this function is intended to be locale-specific. * * @return a string representation of all the elements in this <tt>Array</tt>, separated by a locale-specific * separator */ public String toLocaleString() { StringBuilder builder = new StringBuilder(); String sep = ""; for (int i = 0; i < this.length; i++) { builder.append(sep); sep = ","; V item = this.array.get(i); if (item != null) { builder.append(JSObjectAdapter.toLocaleString(item)); } } return builder.toString(); }
@Override public void $invoke(Object p1) { JSObjectAdapter.$put(cache, cacheKey, p1); if (cacheKey != null) { JSObjectAdapter.$properties(fetching).$delete(cacheKey); } } }, new Callback1<String>() {
public static AssertionCodebook getCodebook(Assertion assertion) { if (codebooks == null) codebooks = new Object(); return (AssertionCodebook) JSObjectAdapter.$get(codebooks,assertion.id); } }
private static void find(final String url, final String error, final Object history, final int i, final Callback1<EcRemoteLinkedData> success, final Callback1<String> failure) { if (JSGlobal.isNaN(i) || (Object) i == JSGlobal.undefined || i > repos.$length() || repos.$get(i) == null) { JSObjectAdapter.$properties(fetching).$delete(url); if (failure != null) failure.$invoke(error); return; if (((Boolean) JSObjectAdapter.$get(history, repo.selectedServer)) == true) { find(url, error, history, i + 1, success, failure); return; JSObjectAdapter.$put(history, repo.selectedServer, true); repo.search("@id:\"" + url + "\"", null, new Callback1<Array<EcRemoteLinkedData>>() { @Override
private void createContactFolder() { final OAuth2FileBasedRemoteIdentityManager me = this; Object o = new Object(); JSObjectAdapter.$put(o, "name", "CASS Contacts"); hello.api(me.network + "/" + "me/folders", "post", o).then(new Callback1<Object>() { @Override public void $invoke(Object r) { me.hookIdentityManagerContacts((String) JSObjectAdapter.$get(r, "id")); } }); }
public EcCompetency() { Map<String, Object> me = JSObjectAdapter.$properties(this); if (template != null) { Map<String, Object> you = JSObjectAdapter.$properties(template); for (String key : you) { if (JSGlobal.typeof(you.$get(key)) != "function") me.$put(key.replace("@", ""), you.$get(key)); } } }
@Override public void $invoke(Object p1) { JSObjectAdapter.$put(cache, cacheKey, p1); if (cacheKey != null) { JSObjectAdapter.$properties(fetching).$delete(cacheKey); } } }, new Callback1<String>() {
@Override public void $invoke(Object p1) { if (p1 != null) { if (JSObjectAdapter.$get(p1, "ping") == "pong") { if (JSObjectAdapter.$get(p1, "time") != null) me.timeOffset = ((Long)(Object)new Date().getTime())-((Long)(Object)JSObjectAdapter.$get(p1, "time")); me.selectedServer = guess; me.autoDetectFound = true; } } } };
Map<String, Object> me = JSObjectAdapter.$properties(this); for (String key : me) { if (JSGlobal.typeof(me.$get(key)) != "function") me.$delete(key); Map<String, Object> you = JSObjectAdapter.$properties(that); for (String key : you) { if (JSGlobal.typeof(you.$get(key)) != "function") { Array<String> typeParts = (Array<String>) (Object) this.type.split(":"); if (typeParts.$length() == 2) { newContext = (String) JSObjectAdapter.$get(context, typeParts.$get(0)); stripNamespace = typeParts.$get(0); if (!newContext.endsWith("/")) newContext += "/"; } else if (JSObjectAdapter.$get(context, "@vocab") != null) newContext = (String) JSObjectAdapter.$get(context, "@vocab"); if (key.startsWith(stripNamespace + ":")) { if (EcArray.isArray(me.$get(key))) { JSObjectAdapter.$put(me, key.replace(stripNamespace + ":", ""), Global.JSON.parse(Global.JSON.stringify(me.$get(key)).replaceAll(stripNamespace + ":", ""))); } else if (EcObject.isObject(me.$get(key))) { JSObjectAdapter.$put(me, key.replace(stripNamespace + ":", ""), Global.JSON.parse(Global.JSON.stringify(me.$get(key)).replaceAll(stripNamespace + ":", ""))); } else JSObjectAdapter.$put(me, key.replace(stripNamespace + ":", ""), me.$get(key)); me.$delete(key);
private void createIdentityFolder(final Callback1<Object> success) { final OAuth2FileBasedRemoteIdentityManager me = this; Object o = new Object(); JSObjectAdapter.$put(o, "name", "CASS Identities"); hello.api(me.network + "/" + "me/folders", "post", o).then(new Callback1<Object>() { @Override public void $invoke(Object r) { me.hookIdentityManagerIdentities((String) JSObjectAdapter.$get(r, "id")); success.$invoke(r); } }); }