Class ResourceActionSet.Builder
java.lang.Object
com.inductiveautomation.ignition.gateway.config.actions.ResourceActionSet.Builder
- Enclosing class:
ResourceActionSet
-
Method Summary
Modifier and TypeMethodDescriptionbuild()copy(@Nullable ResourceAction.Copy copy) Sets the default Copy operation to aResourceAction.Copy.create(@Nullable ResourceAction.Create create) Sets the default Create operation to aResourceAction.Create.delete(@Nullable ResourceAction.Delete delete) Sets the default Delete operation to aResourceAction.Delete.listResources(@Nullable ResourceAction.ListResources listResources) Sets the default ListResources operation to aResourceAction.ListResources.modify(@Nullable ResourceAction.Modify modify) Sets the default Modify operation to aResourceAction.Modify.move(@Nullable ResourceAction.Move move) Sets the default Move operation to aResourceAction.Move.read(@Nullable ResourceAction.Read read) Sets the default Read operation to aResourceAction.Read.rename(@Nullable ResourceAction.Rename rename) Sets the default Rename operation to aResourceAction.Rename.withValidatingCopy(@NonNull Function<DefaultResourceActions.CopyResource<R>, Optional<ValidationErrors>> validator) Sets the default Copy operation to aDefaultResourceActions.ValidatingCopy, which is backed by the default copy action, but additionally decodes the actual resource and allows for the caller to check the resource for validity.withValidatingCreate(@NonNull Function<DefaultResourceActions.CreateResources<R>, Optional<ValidationErrors>> validator) Sets the default Create operation to aDefaultResourceActions.ValidatingCreate, which is backed by the default create action, but additionally decodes the actual resource and allows for the caller to check the resource for validity.withValidatingModify(@NonNull Function<DefaultResourceActions.ModifyResources<R>, Optional<ValidationErrors>> validator) Sets the default Modify operation to aDefaultResourceActions.ValidatingModify, which is backed by the default modify action, but additionally decodes the actual resource and allows for the caller to check the resource for validity.withValidatingMove(@NonNull Function<DefaultResourceActions.MoveResource<R>, Optional<ValidationErrors>> validator) Sets the default Move operation to aDefaultResourceActions.ValidatingMove, which is backed by the default move action, but additionally decodes the actual resource and allows for the caller to check the resource for validity.withValidatingRename(@NonNull Function<DefaultResourceActions.RenameResource<R>, Optional<ValidationErrors>> validator) Sets the default Rename operation to aDefaultResourceActions.ValidatingRename, which is backed by the default rename action, but additionally decodes the actual resource and allows for the caller to check the resource for validity.
-
Method Details
-
read
Sets the default Read operation to aResourceAction.Read. If null, reading of resources is disallowed. Typically, your implementation should just proxy to the DefaultDefaultResourceActions.Readto ensure proper reading of the resource from theConfigurationManager- Parameters:
read- The Read operation. May be null to disallow reading resources
-
listResources
public ResourceActionSet.Builder listResources(@Nullable ResourceAction.ListResources listResources) Sets the default ListResources operation to aResourceAction.ListResources. If null, listing resources is disallowed. Typically, your implementation should just proxy to the DefaultDefaultResourceActions.ListResourcesto ensure proper reading of the resource from theConfigurationManager- Parameters:
listResources- The ListResources operation. May be null to disallow listing resources
-
create
Sets the default Create operation to aResourceAction.Create. If null, creation of resources is disallowed. Typically, your implementation should just proxy to the DefaultDefaultResourceActions.Createto ensure proper creation and saving of the resource to theConfigurationManager- Parameters:
create- The Create operation. may be null to disallow creation of resources
-
withValidatingCreate
public <R> ResourceActionSet.Builder withValidatingCreate(@NonNull Function<DefaultResourceActions.CreateResources<R>, Optional<ValidationErrors>> validator) Sets the default Create operation to aDefaultResourceActions.ValidatingCreate, which is backed by the default create action, but additionally decodes the actual resource and allows for the caller to check the resource for validity. This does add some overhead, so it is recommended to use the default create if all you need is the information inResourceAction.CreateRequest. This method andcreate(ResourceAction.Create)set the same action, so whichever is called last wins.- Type Parameters:
R- the configuration class set on theResourceTypeMetaof the resource being created.- Parameters:
validator- a function that accepts aDefaultResourceActions.CreateResourcesand returns anOptionalofValidationErrorsif the resource is invalid, or empty if it is valid.
-
modify
Sets the default Modify operation to aResourceAction.Modify. If null, modifying resources is disallowed. Typically, your implementation should just proxy to the DefaultDefaultResourceActions.Modifyto ensure proper modification of the resource in theConfigurationManager- Parameters:
modify- The Modify operation. May be null to disallow modification of resources
-
withValidatingModify
public <R> ResourceActionSet.Builder withValidatingModify(@NonNull Function<DefaultResourceActions.ModifyResources<R>, Optional<ValidationErrors>> validator) Sets the default Modify operation to aDefaultResourceActions.ValidatingModify, which is backed by the default modify action, but additionally decodes the actual resource and allows for the caller to check the resource for validity. This does add some overhead, so it is recommended to use the default Modify if all you need is the information inResourceAction.ModifyRequest. This method andmodify(ResourceAction.Modify)set the same action, so whichever is called last wins.- Type Parameters:
R- the configuration class set on theResourceTypeMetaof the resource being modified.- Parameters:
validator- a function that accepts aDefaultResourceActions.ModifyResourcesand returns anOptionalofValidationErrorsif the resource is invalid, or empty if it is valid.
-
delete
Sets the default Delete operation to aResourceAction.Delete. If null, deleting resources is disallowed. Typically, your implementation should just proxy to the DefaultDefaultResourceActions.Deleteto ensure proper deletion of the resource in theConfigurationManager- Parameters:
delete- The Delete operation. May be null to disallow deletion of resources
-
move
Sets the default Move operation to aResourceAction.Move. If null, moving resources is disallowed. Typically, your implementation should just proxy to the DefaultDefaultResourceActions.Moveto ensure the resource is moved to the proper location in theConfigurationManager- Parameters:
move- The Move operation. May be null to disallow moving of resources
-
withValidatingMove
public <R> ResourceActionSet.Builder withValidatingMove(@NonNull Function<DefaultResourceActions.MoveResource<R>, Optional<ValidationErrors>> validator) Sets the default Move operation to aDefaultResourceActions.ValidatingMove, which is backed by the default move action, but additionally decodes the actual resource and allows for the caller to check the resource for validity. This does add some overhead, so it is recommended to use the default Move if all you need is the information inResourceAction.Move.move(ConfigurationManager, ResourceType, String, String, String, String, ImmutableBytes, ResourceAction.ContextObject). This method andmove(ResourceAction.Move)set the same action, so whichever is called last wins.- Type Parameters:
R- the configuration class set on theResourceTypeMetaof the resource being moved.- Parameters:
validator- a function that accepts aDefaultResourceActions.MoveResourceand returns anOptionalofValidationErrorsif the resource is invalid, or empty if it is valid.
-
copy
Sets the default Copy operation to aResourceAction.Copy. If null, copying resources is disallowed. Typically, your implementation should just proxy to the DefaultDefaultResourceActions.Copyto ensure the resource is copied properly inConfigurationManager- Parameters:
copy- The Copy operation. May be null to disallow copying resources
-
withValidatingCopy
public <R> ResourceActionSet.Builder withValidatingCopy(@NonNull Function<DefaultResourceActions.CopyResource<R>, Optional<ValidationErrors>> validator) Sets the default Copy operation to aDefaultResourceActions.ValidatingCopy, which is backed by the default copy action, but additionally decodes the actual resource and allows for the caller to check the resource for validity. This does add some overhead, so it is recommended to use the default Copy if all you need is the information inResourceAction.Copy.copy(ConfigurationManager, ResourceType, String, String, String, String, ImmutableBytes, ResourceAction.ContextObject). This method andcopy(ResourceAction.Copy)set the same action, so whichever is called last wins.- Type Parameters:
R- the configuration class set on theResourceTypeMetaof the resource being copied.- Parameters:
validator- a function that accepts aDefaultResourceActions.CopyResourceand returns anOptionalofValidationErrorsif the resource is invalid, or empty if it is valid.
-
rename
Sets the default Rename operation to aResourceAction.Rename. If null, renaming resources is disallowed. Typically, your implementation should just proxy to the DefaultDefaultResourceActions.Renameto ensure the resource is renamed properly inConfigurationManager- Parameters:
rename- The Rename operation. May be null to disallow renaming resources
-
withValidatingRename
public <R> ResourceActionSet.Builder withValidatingRename(@NonNull Function<DefaultResourceActions.RenameResource<R>, Optional<ValidationErrors>> validator) Sets the default Rename operation to aDefaultResourceActions.ValidatingRename, which is backed by the default rename action, but additionally decodes the actual resource and allows for the caller to check the resource for validity. This does add some overhead, so it is recommended to use the default Rename if all you need is the information inResourceAction.Rename.rename(ConfigurationManager, ResourceType, String, String, ReferenceHandling, String, ResourceAction.ContextObject). This method andrename(ResourceAction.Rename)set the same action, so whichever is called last wins.- Type Parameters:
R- the configuration class set on theResourceTypeMetaof the resource being renamed.- Parameters:
validator- a function that accepts aDefaultResourceActions.RenameResourceand returns anOptionalofValidationErrorsif the resource is invalid, or empty if it is valid.
-
build
-