@Override public void $invoke(String p1) { me.configured = false; if (failure != null) failure.$invoke(p1); else Global.console.error(p1); } });
/** * Saves this file in the repository using the repository web services * * @param {Callback1<String>} success * Callback triggered if successfully saved * @param {Callback1<String>} failure * Callback triggered if error occurs while saving * @memberOf EcFile * @method save */ public void save(final Callback1<String> success, Callback1<String> failure) { if (this.name == null || this.name == "") { String msg = "File Name can not be empty"; if (failure != null) failure.$invoke(msg); else Global.console.error(msg); return; } EcRepository.save(this, success, failure); }
failure.$invoke(msg); else Global.console.error(msg); return; failure.$invoke(msg); else Global.console.error(msg); return; failure.$invoke(msg); else Global.console.error(msg); return; failure.$invoke(msg); else Global.console.error(msg); return; failure.$invoke(msg); else Global.console.error(msg); return; failure.$invoke(msg); else Global.console.error(msg); return;
/** * Saves this frameworks details on the server specified by it's ID * * @param {Callback1<String>} success * Callback triggered after successfully saving the framework * @param {Callback1<String>} failure * Callback triggered if error occurs while saving the framework * @memberOf EcFramework * @method save */ public void save(Callback1<String> success, Callback1<String> failure, EcRepository repo) { if (this.name == null || this.name == "") { String msg = "Framework Name Cannot be Empty"; if (failure != null) failure.$invoke(msg); else Global.console.error(msg); return; } if (repo == null) EcRepository.save(this, success, failure); else repo.saveTo(this, success, failure); }
/** * Saves the competency details to the server * * @param {Callback1<String>} success * Callback triggered on successfully saving the competency * @param {Callback1<String>} failure * Callback triggered if error saving competency * @memberOf EcCompetency * @method save */ public void save(Callback1<String> success, Callback1<String> failure, EcRepository repo) { if (this.name == null || this.name == "") { String msg = "Competency Name can not be empty"; if (failure != null) failure.$invoke(msg); else Global.console.error(msg); return; } if (repo == null) EcRepository.save(this, success, failure); else repo.saveTo(this,success,failure); }
@Override public void $invoke(EcRemoteLinkedData p1) { EcAssertion assertion = new EcAssertion(); if (p1.isAny(assertion.getTypes())) { assertion.copyFrom(p1); if (success != null) success.$invoke(assertion); } else { String msg = "Retrieved object was not an assertion"; if (failure != null) failure.$invoke(msg); else Global.console.error(msg); } } }, failure);
/** * Adds a reader to the object, if the reader does not exist. * * @param {EcPk} newReader PK of the new reader. * @memberOf EcEncryptedValue * @method addReader */ public void addReader(EcPk newReader) { String pem = newReader.toPem(); if (reader == null) { reader = new Array<String>(); } for (int i = 0; i < reader.$length(); i++) { if (reader.$get(i) == pem) { return; } } EcArray.setAdd(reader,pem); EbacEncryptedSecret payloadSecret = decryptSecret(); if (payloadSecret == null) { Global.console.error("Cannot add a Reader if you don't know the secret"); return; } EcArray.setAdd(secret, EcRsaOaep.encrypt(newReader, payloadSecret.toEncryptableJson())); }
@Override public void $invoke(EcRemoteLinkedData p1) { EcConceptScheme scheme = new EcConceptScheme(); if (p1.isA(EcEncryptedValue.myType)) { EcEncryptedValue encrypted = new EcEncryptedValue(); encrypted.copyFrom(p1); p1 = encrypted.decryptIntoObject(); EcEncryptedValue.encryptOnSave(p1.id, true); } if (p1.isAny(scheme.getTypes())) { scheme.copyFrom(p1); if (success != null) success.$invoke(scheme); } else { String msg = "Resultant object is not a concept scheme."; if (failure != null) failure.$invoke(msg); else Global.console.error(msg); } } }, new Callback1<String>() {
@Override public void $invoke(EcRemoteLinkedData p1) { EcLevel level = new EcLevel(); if (p1.isA(EcEncryptedValue.myType)) { EcEncryptedValue encrypted = new EcEncryptedValue(); encrypted.copyFrom(p1); p1 = encrypted.decryptIntoObject(); EcEncryptedValue.encryptOnSave(p1.id, true); } if (p1.isAny(level.getTypes())) { level.copyFrom(p1); if (success != null) success.$invoke(level); } else { String msg = "Resultant object is not a level."; if (failure != null) failure.$invoke(msg); else Global.console.error(msg); } } }, failure);
@Override public void $invoke(EcRemoteLinkedData p1) { EcFramework framework = new EcFramework(); if (p1.isA(EcEncryptedValue.myType)) { EcEncryptedValue encrypted = new EcEncryptedValue(); encrypted.copyFrom(p1); p1 = encrypted.decryptIntoObject(); EcEncryptedValue.encryptOnSave(p1.id, true); } if (p1.isAny(framework.getTypes())) { framework.copyFrom(p1); if (success != null) success.$invoke(framework); } else { String msg = "Resultant object is not a framework."; if (failure != null) failure.$invoke(msg); else Global.console.error(msg); } } }, new Callback1<String>() {
} else { String msg = "Retrieved object was not a concept"; Global.console.error(msg); return null;
} else { String msg = "Retrieved object was not a competency"; Global.console.error(msg); return null;
} else { String msg = "Retrieved object was not a level"; Global.console.error(msg); return null;
} else { String msg = "Retrieved object was not a relation"; Global.console.error(msg); return null;
@Override public void $invoke(EcRemoteLinkedData p1) { if (p1 instanceof EcAlignment) if (success != null) { success.$invoke((EcAlignment) p1); return; } EcAlignment relation = new EcAlignment(); if (p1.isA(EcEncryptedValue.myType)) { EcEncryptedValue encrypted = new EcEncryptedValue(); encrypted.copyFrom(p1); p1 = encrypted.decryptIntoObject(); } if (p1.isAny(relation.getTypes())) { relation.copyFrom(p1); if (EcRepository.caching) { JSObjectAdapter.$put(EcRepository.cache, relation.shortId(), relation); JSObjectAdapter.$put(EcRepository.cache, relation.id, relation); } if (success != null) success.$invoke(relation); } else { String msg = "Resultant object is not a relation."; if (failure != null) failure.$invoke(msg); else Global.console.error(msg); } } }, failure);
/** * Removes a reader from the object, if the reader does exist. * * @param {EcPk} oldReader PK of the old reader. * @memberOf EcEncryptedValue * @method removeReader */ public void removeReader(EcPk oldReader) { EbacEncryptedSecret payloadSecret = decryptSecret(); String pem = oldReader.toPem(); if (reader != null) { EcArray.setRemove(reader, pem); } if (payloadSecret == null) { Global.console.error("Cannot remove a Reader if you don't know the secret"); return; } secret = new Array<>(); if (owner != null) for (int i = 0;i < owner.$length();i++) EcArray.setAdd(secret, EcRsaOaep.encrypt(EcPk.fromPem(owner.$get(i)), payloadSecret.toEncryptableJson())); if (reader != null) for (int i = 0;i < reader.$length();i++) EcArray.setAdd(secret, EcRsaOaep.encrypt(EcPk.fromPem(reader.$get(i)), payloadSecret.toEncryptableJson())); }
failure.$invoke(msg); } else { Global.console.error(msg);