use of jsinterop.annotations.JsIgnore in project console by hal.
the class ComplexAttributeOperations method reset.
/**
* Undefines all non required attributes in the specified form. After the attributes in the complex attribute have been
* undefined a standard success message is fired and the specified callback is executed.
* <p>
* If the form contains only required attributes, a warning message is fired and the specified callback is executed.
*
* @param resource the resource name
* @param complexAttribute the name of the complex attribute
* @param type the human readable name of the complex attribute
* @param template the address template which is resolved against the current statement context and the resource name to get
* the resource address for the operation
* @param form the form which should be reset
* @param callback the callback executed after the resource has been saved
*/
@JsIgnore
public <T> void reset(String resource, String complexAttribute, String type, AddressTemplate template, Metadata metadata, Form<T> form, Callback callback) {
Set<String> attributes = stream(form.getBoundFormItems().spliterator(), false).map(FormItem::getName).collect(toSet());
ResourceAddress address = template.resolve(statementContext, resource);
Composite composite = operationFactory(complexAttribute).resetResource(address, attributes, metadata);
reset(type, composite, callback);
}
use of jsinterop.annotations.JsIgnore in project console by hal.
the class CrudOperations method save.
// ------------------------------------------------------ (u)pdate using address
/**
* Writes the changed values to the specified resource. After the resource has been saved a standard success message is
* fired and the specified callback is executed.
* <p>
* If the change set is empty, a warning message is fired and the specified callback is executed.
*
* @param type the human readable resource type used in the success message
* @param name the resource name
* @param address the fq address for the operation
* @param changedValues the changed values / payload for the operation
* @param metadata the metadata of the attributes in the change set
* @param callback the callback executed after the resource has been saved
*/
@JsIgnore
public void save(String type, String name, ResourceAddress address, Map<String, Object> changedValues, Metadata metadata, Callback callback) {
Composite operations = operationFactory.fromChangeSet(address, changedValues, metadata);
save(operations, resources.messages().modifyResourceSuccess(type, name), callback);
}
use of jsinterop.annotations.JsIgnore in project console by hal.
the class CrudOperations method readChildren.
/**
* Read multiple different child resources using a composite operation. The steps in the composite result map to the
* position of the resource in the {@code resources} collection.
*
* @param address the fq address for the {@code read-children-resource} operation
* @param resources the child resources (not human readable, but the actual child resource name!)
* @param callback the callback which gets the composite result
*/
@JsIgnore
public void readChildren(ResourceAddress address, Iterable<String> resources, ReadCompositeCallback callback) {
List<Operation> operations = stream(resources.spliterator(), false).map(resource -> new Operation.Builder(address, READ_CHILDREN_RESOURCES_OPERATION).param(CHILD_TYPE, resource).build()).collect(toList());
dispatcher.execute(new Composite(operations), callback::execute);
}
use of jsinterop.annotations.JsIgnore in project console by hal.
the class CrudOperations method remove.
// ------------------------------------------------------ (d)elete using address
/**
* Shows a confirmation dialog and removes the resource if confirmed by the user. After the resource has been removed a
* success message is fired and the specified callback is executed.
*
* @param type the human readable resource type used in the success message
* @param name the resource name
* @param address the fq address for the {@code remove} operation
* @param callback the callback executed after the resource has been removed
*/
@JsIgnore
public void remove(String type, String name, ResourceAddress address, Callback callback) {
String title = resources.messages().removeConfirmationTitle(type);
SafeHtml question = name == null ? resources.messages().removeSingletonConfirmationQuestion() : resources.messages().removeConfirmationQuestion(name);
SafeHtml success = name == null ? resources.messages().removeSingletonResourceSuccess(type) : resources.messages().removeResourceSuccess(type, name);
DialogFactory.showConfirmation(title, question, () -> {
Operation operation = new Operation.Builder(address, REMOVE).build();
dispatcher.execute(operation, result -> {
MessageEvent.fire(eventBus, Message.success(success));
callback.execute();
});
});
}
use of jsinterop.annotations.JsIgnore in project console by hal.
the class ExtensionRegistry method verifyMetadata.
@JsIgnore
public void verifyMetadata(String url, MetadataCallback metadataCallback) {
SafeUri safeUrl = UriUtils.fromString(url);
XMLHttpRequest xhr = new XMLHttpRequest();
xhr.onload = event -> {
int status = (int) xhr.status;
if (status >= 200 && status < 400) {
String responseText = xhr.responseText;
if (Strings.isNullOrEmpty(responseText)) {
// 415 - Unsupported Media Type
metadataCallback.result(415, null);
} else {
JsonObject extensionJson = Json.parse(responseText);
metadataCallback.result(status, extensionJson);
}
} else {
metadataCallback.result(status, null);
}
};
// NON-NLS
xhr.addEventListener("error", event -> metadataCallback.result(503, null), false);
xhr.open(GET.name(), safeUrl.asString(), true);
xhr.send();
}
Aggregations