About the Repository Service
The Repository service provides resource storage and management services to AEM Forms. When developers create an AEM Forms application, they can deploy the assets in the repository instead of the file system. The assets can include any type of collateral, including XML forms, PDF forms (including Acrobat forms), form fragments, images, profiles, policies, SWF files, DDX files, XML schemas, WSDL files, and test data.
For example, consider the following Forms application named Applications/FormsApplication:
Notice that there is a file named Loan.xdp located in the FormsFolder. To access this form design, you specify the complete path (including version): Applications/FormsApplication/1.0/FormsFolder/Loan.xdp
.
For information about creating a Forms application using Workbench, see Workbench Help.
The path to a resource located in the AEM Forms repository is:
Applications/Application-name/Application-version/Folder.../Filename
The following values show some examples of URI values:
You can browse the AEM Forms Repository by using a web browser. To browse the repository, enter the following URL into a web browser https://[server name]:[server port]/repository. You can verify quick start results that are associated with the Working with AEM Forms Repository section by using a web browser. For example, if you add content to the AEM Forms Repository, you can see the content in a web browser. (See Quick Start (SOAP mode): Writing a resource using the Java API.)
The repository API provides a number of operations that you can use to store and retrieve information from the repository. For example, you can obtain a list of resources or retrieve specific resources that are stored in the repository when a resource is needed as part of processing an application.
The repository API cannot be used to interact with Content Services (deprecated). To interact with Content Services (deprecated), you use the Document Management API.
Using the Repository service API, you can accomplish the following tasks:
Using the repository API, you cannot manage resource access control, search for resources, or specify resource relationships by using an ECM repository.
When an encrypted PDF is written to the repository, the automated relationship extraction feature cannot be used. Otherwise, an encrypted PDF can be stored in the repository and later retrieved. The retriever can choose to decrypt the PDF after it is retrieved from the repository.
For more information about the Repository service, see Services Reference for AEM Forms.
Folders (resource collections) are used to store objects (files or resources) in organized groupings. Folders can contain resources and other folders, also known as subfolders. Resources can only be stored in one folder at a time.
Files inherit access control lists (ACLs) from folders, and subfolders inherit ACLs from their parent folders. Therefore, the parent folders must exist before you can create child folders. The IDE lets you interact only on a folder-by-folder basis, not on a file-by-file basis. You cannot version folders and there is no need to do so; a folder does not contain data itself. Rather, it is only a container for resources that contain data. The default ACL is system-level permission, which means that users must have system-level permissions (read, write, traverse, managing ACLs) until someone gives them permissions for a particular folder. ACLs only work in the IDE.
For more information about the Repository service, see Services Reference for AEM Forms.
To create a folder, follow these steps:
Include project files
Include the necessary files in your development project. If you are creating a client application using Java, include the necessary JAR files. If you are using web services, include the proxy files.
Create the service client
Before you can programmatically create a resource collection, you must establish a connection and provide credentials. This is accomplished by creating a service client.
Create the folder
Invoke the Repository service method to create the resource collection and populate the resource collection with identifying information, including its UUID, folder name, and description.
Write the folder to the repository
Invoke the Repository service method to write the resource collection, specifying the target folder’s URI.
See also
Create folders using the Java API
Create folders using the web service API
Including AEM Forms Java library files
Repository Service API Quick Starts
Create a folder by using the Repository service API (Java):
Include project files
Include project files in your Java project’s class path.
Create the service client
Create a ResourceRepositoryClient
object by using its constructor and passing a ServiceClientFactory
object that contains connection properties.
Create the folder
To create a resource collection, you must first create a com.adobe.repository.infomodel.bean.RepositoryInfomodelFactoryBean
object.
Invoke the repositoryInfomodelFactoryBean
object’s newResourceCollection
method, and pass in the following parameters:
com.adobe.repository.infomodel.Id
UUID identifier to be assigned to the resource.com.adobe.repository.infomodel.Lid
UUID identifier to be assigned to the resource.java.lang.String
containing the name of the resource collection. For example, FormsFolder
.The method returns a com.adobe.repository.infomodel.bean.ResourceCollection
object representing the new folder.
Set the folder’s description by using the setDescription
method and pass in the following parameter:
String
that describes the resource collection. In this example, "test Folder"
is used .
Write the folder to the repository
Invoke the ResourceRepositoryClient
object’s writeResource
method and pass in the URI of the folder and the ResourceCollection
object. For example, the URI to the folder can be the following value /Applications/FormsApplication/1.0/
.
The method returns an instance of the newly created com.adobe.repository.infomodel.bean.Resource
object. You can, for example, retrieve the identifier value of the new resource by invoking the com.adobe.repository.infomodel.bean.Resource
object’s getId
method.
See also
Quick Start (SOAP mode): Creating a folder using the Java API
Including AEM Forms Java library files
Create a folder by using the Repository service API (web service):
Include project files
Create the service client
Using the Microsoft .NET client assembly, create a RepositoryServiceService
object by invoking its default constructor. Set its Credentials
property using a System.Net.NetworkCredential
object that contains the user name and password.
Create the folder
Create the folder by using the default constructor for the ResourceCollection
class and pass in the following parameters:
Id
object, which is created by invoking the default constructor for the Id
class and assigned to the Resource
object’s id
field.Lid
object, which is created by invoking the default constructor for the Lid
class and assigned to the Resource
object’s lid
field.Resource
object’s name
field. The name used in this example is "testfolder"
.Resource
object’s description
field. The description used in this example is "test folder"
.Write the folder to the repository
Invoke the RepositoryServiceService
object’s writeResource
method and pass in the following parameters:
ResourceCollection
object representing the folder.null
for the other two parameters.See also
Invoking AEM Forms using Base64 encoding
You can create resources in a given location in the repository. The natural file size is subject to database limitations and session time-out. For the default configuration, files are limited to 25 MB. To raise or lower the maximum file size, you must change the database configuration.
Writing resources is equivalent to storing data in the repository. Once you write a resource to the repository, it becomes accessible to all clients in the repository ecosystem. When you write resources, such as XML schemas, XDP files, and XSD files, to the repository, the contents are parsed based on the MIME type. If the MIME type is supported, the parser determines whether there is an implied relationship to other content. For example, if a cascading style sheet (CSS) has a relative URL that references a common CSS, it is expected that you will submit the common CSS into the repository as well. The relationship between the two resources is stored as a pending relationship for a non-adjustable period of 30 days. When you submit the common CSS to the repository within the 30-day period, the relationship is formed.
When you create a resource, the access control list (ACL) is inherited from the parent folder. The root folder has system-level permissions until an initial resource or folder is created, at which point the resource or folder is given default ACL permissions.
You can programmatically write resources by using the Repository service Java API or web service API.
For more information about the Repository service, see Services Reference for AEM Forms.
To write a resource, follow these steps:
Include project files
Include the necessary files in your development project. If you are creating a client application using Java, include the necessary JAR files. If you are using web services, include the proxy files.
Create the service client
Before you can programmatically read a resource, you must establish a connection and provide credentials. This is accomplished by creating a service client.
Specify the URI of the target folder for the resource
Create a string containing the URI of the resource to be read. The syntax includes forward slashes, as in this example: “/path/folder”.
Create the resource
Invoke the Repository service method to create the resource, and populate the resource with identifying information, including its UUID, resource name, and description.
Specify the resource content
Invoke the Repository service method to create resource content, and store that content in the resource.
Write the resource to the target folder
Invoke the Repository service method to write the resource, specifying the target folder’s URI.
See also
Write resources using the Java API
Write resources using the web service API
Including AEM Forms Java library files
Repository Service API Quick Starts
Write a resource by using the Repository service API (Java):
Include project files
Include client JAR files in your Java project’s class path.
Create the service client
Create a ResourceRepositoryClient
object by using its constructor and passing a ServiceClientFactory
object that contains connection properties.
Specify the URI of the target folder for the resource
Specify the URI of the target folder for the resource. In this case, because the resource named testResource
will be stored in the folder named testFolder
, the folder’s URI is "/testFolder"
. The URI is stored as a java.lang.String
object.
Create the resource
To create a resource, you must first create a com.adobe.repository.infomodel.bean.RepositoryInfomodelFactoryBean
object.
Invoke the RepositoryInfomodelFactoryBean
object’s newResource
method, which creates a com.adobe.repository.infomodel.bean.Resource
object. In this example, the following parameters are provided:
com.adobe.repository.infomodel.Id
object, which is created by invoking the default constructor for the Id
class.com.adobe.repository.infomodel.Lid
object, which is created by invoking the default constructor for the Lid
class.java.lang.String
containing the file name of the resource.To specify the resource’s description, invoke the Resource
object’s setDescription
method and pass a string containing the description. In this example, the description is "test resource"
.
Specify the resource content
To create content for the resource, invoke the RepositoryInfomodelFactoryBean
object’s newResourceContent
method, which returns a com.adobe.repository.infomodel.bean.ResourceContent
object. Add content to the ResourceContent
object. In this example, this is accomplished by doing the following tasks:
ResourceContent
object’s setDataDocument
method and passing in a com.adobe.idp.Document
objectResourceContent
object’s setSize
method and passing in the size in bytes of the Document
objectAdd the content to the resource by invoking the Resource
object’s setContent
method and passing in the ResourceContent
object. For more information, see AEM Forms API Reference.
Write the resource to the target folder
Invoke the ResourceRepositoryClient
object’s writeResource
method and pass in the URI of the folder, as well as the Resource
object.
See also
Quick Start (SOAP mode): Writing a resource using the Java API
Including AEM Forms Java library files
Write a resource by using the Repository service API (web service):
Include project files
Create the service client
Using the Microsoft .NET client assembly, create a RepositoryServiceService
object by invoking its default constructor. Set its Credentials
property using a System.Net.NetworkCredential
object containing the user name and password.
Specify the URI of the target folder for the resource
Specify the URI of the target folder for the resource. In this case, because the resource named testResource
will be stored in the folder named testFolder
, the folder’s URI is "/testFolder"
. When using a language compliant with the Microsoft .NET Framework (for example, C#), store the URI in a System.String
object.
Create the resource
To create a resource, invoke the default constructor for the Resource
class. In this example, the following information is stored in the Resource
object:
com.adobe.repository.infomodel.Id
object, which is created by invoking the default constructor for the Id
class and assigned to the Resource
object’s id
field.com.adobe.repository.infomodel.Lid
object, which is created by invoking the default constructor for the Lid
class and assigned to the Resource
object’s lid
field.Resource
object’s name
field. The name used in this example is "testResource"
.Resource
object’s description
field. The description used in this example is "test resource"
.Specify the resource content
To create content for the resource, invoke the default constructor for the ResourceContent
class. Then add content to the ResourceContent
object. In this example, this is accomplished by doing the following tasks:
BLOB
object containing a document to the ResourceContent
object’s dataDocument
field.BLOB
object to the ResourceContent
object’s size
field.Add the content to the resource by assigning the ResourceContent
object to the Resource
object’s content
field.
Write the resource to the target folder
Invoke the RepositoryServiceService
object’s writeResource
method and pass in the URI of the folder, as well as the Resource
object. Pass null
for the other two parameters.
See also
Invoking AEM Forms using Base64 encoding
You can discover resources by listing resources. A query is performed against the repository to find all the resources that are related to a given resource collection.
Once you organize your resources, you can inspect the structure you created by seeing a particular branch of the structure, much like you would do in an operating system.
Listing resources operates by relationship: resources are members of folders. Membership is represented by a relationship of type “member of”. When you list resources in a given folder, you are querying for resources that are related to a given folder by the relationship “member of”. Relationships are directional: a member of a relationship has a source that is a member of the target. The source is the resource; the target is the parent folder.
For more information about the Repository service, see Services Reference for AEM Forms.
To list resources, follow these steps:
Include project files
Include the necessary files in your development project. If you are creating a client application using Java, include the necessary JAR files. If you are using web services, include the proxy files.
Create the service client
Before you can programmatically create a resource collection, you must establish a connection and provide credentials. This is accomplished by creating a service client.
Specify the folder path
Create a string containing the path of the folder containing the resources. The syntax includes forward slashes, as in this example: “/path/folder”.
Retrieve the list of resources
Invoke the Repository service method to retrieve the list of resources, specifying the target folder’s path.
See also
List resources using the Java API
List resources using the web service API
Including AEM Forms Java library files
Repository Service API Quick Starts
List resources by using the Repository service API (Java):
Include project files
Include client JAR files in your Java project’s class path.
Create the service client
Create a ResourceRepositoryClient
object by using its constructor and passing a ServiceClientFactory
object that contains connection properties.
Specify the folder path
Specify the URI of the resource collection to be queried. In this case, its URI is "/testFolder"
. The URI is stored as a java.lang.String
object.
Retrieve the list of resources
Invoke the ResourceRepositoryClient
object’s listMembers
method and pass in the URI of the folder.
The method returns a java.util.List
of com.adobe.repository.infomodel.bean.Resource
objects that are the source of a com.adobe.repository.infomodel.bean.Relation
of type Relation.TYPE_MEMBER_OF
and have the resource collection URI as the target. You can iterate through this List
to retrieve each of the resources. In this example, the name and description of each resource is displayed.
See also
Quick Start (SOAP mode): Listing resources using the Java API
Including AEM Forms Java library files
List resources by using the Repository service API (web service):
Include project files
Create the service client
Using the Microsoft .NET client assembly, create a RepositoryServiceService
object by invoking its default constructor. Set its Credentials
property using a System.Net.NetworkCredential
object containing the user name and password.
Specify the folder path
Specify a string containing the URI of the folder to be queried. In this case, its URI is "/testFolder"
. When using a language that is compliant with the Microsoft .NET Framework (for example, C#), store the URI in a System.String
object.
Retrieve the list of resources
Invoke the RepositoryServiceService
object’s listMembers
method and pass in the URI of the folder as the first parameter. Pass null
for the other two parameters.
The method returns an array of objects that can be cast to Resource
objects. You can iterate through the object array to retrieve each of the related resources. In this example, the name and description of each resource is displayed.
See also
Invoking AEM Forms using Base64 encoding
You can retrieve resources from a given location in the repository in order to read their content and metadata. The workflow is front-ended by an initialization form. The process has all the permissions it needs to read the form. The system retrieves the data form and reads the content from the repository. The repository grants access to the content and the metadata (the ability to even know the resource exists).
The repository has the following four permission types:
Users can only run processes when they have permission to run the process. IDE users need traverse and read permissions to synchronize with the repository. ACLs apply only at design time because runtime occurs within the system context.
You can programmatically read resources by using the Repository service Java API or web service API.
For more information about the Repository service, see Services Reference for AEM Forms.
To read a resource, follow these steps:
Include project files
Include the necessary files in your development project. If you are creating a client application using Java, include the necessary JAR files. If you are using web services, include the proxy files.
Create the service client
Before you can programmatically read a resource, you must establish a connection and provide credentials. This is accomplished by creating a service client.
Specify the URI of the resource to be read
Create a string containing the URI of the resource to be read. The syntax includes forward slashes, as in this example: “/path/resource”.
Read the resource
Invoke the Repository service method to read the resource, specifying the URI.
See also
Read resources using the Java API
Reading resources using the web service API
Including AEM Forms Java library files
Repository Service API Quick Starts
Read a resource by using the Repository service API (Java):
Include project files
Include client JAR files in your Java project’s class path.
Create the service client
Create a ResourceRepositoryClient
object by using its constructor and passing a ServiceClientFactory
object that contains connection properties.
Specify the URI of the resource to be read
Specify a string value that represents the URI of the resource to retrieve. For example, assuming the resource is named testResource which is located in a folder named testFolder, specify /testFolder/testResource
.
Read the resource
Invoke the ResourceRepositoryClient
object’s readResource
method and pass the URI of the resource as a parameter. This method returns a Resource
instance that represents the resource.
See also
Quick Start (SOAP mode): Reading a resource using the Java API
Including AEM Forms Java library files
Read a resource by using the Repository service API (web service):
Include project files
Create the service client
Using the Microsoft .NET client assembly, create a RepositoryServiceService
object by invoking its default constructor. Set its Credentials
property using a System.Net.NetworkCredential
object containing the user name and password.
Specify the URI of the resource to be read
Specify a string containing the URI of the resource to be retrieved. In this case, because the resource named testResource
is in the folder named testFolder
, its URI is "/testFolder/testResource"
. When using a language compliant with the Microsoft .NET Framework (for example, C#), store the URI in a System.String
object.
Read the resource
Invoke the RepositoryServiceService
object’s readResource
method and pass the URI of the resource as the first parameter. Pass null
for the other two parameters.
See also
Invoking AEM Forms using Base64 encoding
You can retrieve and update the content of resources in the repository. When you update resources, access control to those resources remains unchanged between versions. When performing an update, you have the option of incrementing the major version. If you do not choose to increment the major version, the minor version is automatically updated.
When you update a resource, the new version is created based on the specified resource attributes. When you update a resource you specify two important parameters: the target URI and a resource instance containing all the updated metadata. It is important to note that if you are not changing a given attribute (for example, the name), the attribute is still required in the instance you pass in. The relationships that are created when parsing the content are added to the specific version and are not brought forward unless specified.
For example, if you update an XDP file and it contains references to other resources, those additional references will also be recorded. Suppose that form.xdp version 1.0 has two external references: a logo and a style sheet, and you subsequently update form.xdp so that it now has three references: a logo, a style sheet, and a schema file. During the update, the repository will add the third relationship (to the schema file) to its pending relation table. Once the schema file is present in the repository, the relationship will automatically be formed. However, if form.xdp version 2.0 no longer uses the logo, form.xdp version 2.0 will not have a relationship to the logo.
All update operations are atomic and transactional. For example, if two users read the same resource and both decide to update version 1.0 to version 2.0, one of them will succeed and one of them will fail, the integrity of the repository will be maintained, and both will get a message confirming success or failure. If the transaction does not commit, it will roll back in the case of database failure and will time out or roll back depending on the application server.
You can programmatically update resources by using the Repository service Java API or web service API.
For more information about the Repository service, see Services Reference for AEM Forms.
To update a resource, follow these steps:
Include project files
Include the necessary files in your development project. If you are creating a client application using Java, include the necessary JAR files. If you are using web services, include the proxy files.
Create the service client
Before you can programmatically read a resource, you must establish a connection and provide credentials. This is accomplished by creating a service client.
Retrieve the resource to be updated
Read the resource. For more information, see Reading Resources.
Update the resource
Set the new information in the resource and invoke the Repository service method to update the resource, specifying the URI, the updated resource, and how the version information should be updated.
See also
Update resources using the Java API
Update resources using the web service API
Including AEM Forms Java library files
Repository Service API Quick Starts
Update a resource by using the Repository service API (Java):
Include project files
Include client JAR files in your Java project’s class path.
Create the service client
Create a ResourceRepositoryClient
object by using its constructor and passing a ServiceClientFactory
object that contains connection properties.
Retrieve the resource to be updated
Specify the URI of the resource to retrieve and read the resource. In this example, the URI of the resource is "/testFolder/testResource"
.
Update the resource
Update the Resource
object’s information. In this example, to update the description, invoke the Resource
object’s setDescription
method and pass the new description string as a parameter.
Then invoke the ServiceClientFactory
object’s updateResource
method, and pass in the following parameters:
java.lang.String
object containing the resource’s URI.Resource
object containing the updated resource information.boolean
value indicating whether to update the major or minor version. In this example, a value of true
is passed in to indicate that the major version is to be incremented.See also
Quick Start (SOAP mode): Updating a resource using the Java API
Including AEM Forms Java library files
Update a resource by using the Repository API (web service):
Include project files
Create the service client
Using the Microsoft .NET client assembly, create a RepositoryServiceService
object by invoking its default constructor. Set its Credentials
property using a System.Net.NetworkCredential
object containing the user name and password.
Retrieve the resource to be updated
Specify the URI of the resource to be retrieved and read the resource. In this example, the URI of the resource is "/testFolder/testResource"
. For more information, see Reading Resources.
Update the resource
Update the Resource
object’s information. In this example, to update the description, assign a new value to the Resource
object’s description
field.
Invoke the RepositoryServiceService
object’s updateResource
method, and pass in the following parameters:
System.String
object containing the resource’s URI.Resource
object containing the updated resource information.boolean
value indicating whether to update the major or minor version. In this example, a value of true
is passed in to indicate that the major version is to be incremented.null
for the remaining two parameters.See also
Invoking AEM Forms using Base64 encoding
You can construct queries used to search for resources in the repository, including history, related resources, and properties.
You can retrieve related resources to determine dependencies between a form and its fragments. For example, if you have a form you can determine what fragments or external resources it uses. If you have an image, you can also find out what forms use the image. You can also search for related resources using filtering based on properties. For example, you can search for all forms that use an image with a specified name, or find any image used by a form with a specified name. You can also search using resource properties. For example, you can conduct a query to find all forms or resources whose name starts with a given string that may include ’%’ and ’_’ wildcards. Remember that searches based on properties are not based on relationships; such searches are based on the assumption that you have specific knowledge about a given resource.
Query statements
A query contains one or more statements that are logically joined with conditions. A statement consists of a left operand, an operator, and a right operand. In addition, you can specify the sort order to be used for the search results. The sort order contains information equivalent to an SQL ORDER BY
clause and is comprised of elements that contain the attributes on which the search was based as well as a value indicating whether ascending or descending order is to be used.
You can programmatically search for resources by using the Repository service Java API. At this time, it is not possible to use the web service API to search for resources.
Sort behaviour
Sort order is not respected when invoking the ResourceRepositoryClient
object’s searchProperties
method and specifying a sort order. For example, assume that you create a resource with three custom properties, where attribute names are name
, secondName
, and asecondName
. Next you create a sort order element on the attribute name and set the ascending
value to true
.
Then you invoke the ResourceRepositoryClient
object’s searchProperties
method and pass in the sort order. The search returns the right resource, with the three properties. However, the properties are not sorted by attribute name. They are returned in the order they were added: name
, secondName
, and asecondName
.
For more information about the Repository service, see Services Reference for AEM Forms.
To search for resources, follow these steps:
Include project files
Include the necessary files in your development project. If you are creating a client application using Java, include the necessary JAR files. If you are using web services, include the proxy files.
Create the service client
Before you can programmatically read a resource, you must establish a connection and provide credentials. This is accomplished by creating a service client.
Specify the target folder for the search
Create a string containing the base path from which to conduct the search. The syntax includes forward slashes, as in this example: “/path/folder”.
Specify the attributes used in the search
You can base your search on the attributes contained within resources. Specify the values of the attributes on which to conduct the search.
Create the query used in the search
Construct a query by using statements and conditions. Each statement will specify the attribute on which to base the search, the condition to be used, and the attribute value to be used in the search.
Create the sort order for the search results
The sort order is comprised of elements, each of which contains one of the attributes used in the search and a value indicating whether ascending or descending order is to be used.
Search for the resources
Search for the resources using the folder, query, and sort order. In addition, indicate the depth of the search and an upper limit on the number of results to be returned.
Retrieve the resources from the search result
Iterate through the returned list of resources and extract the information for further processing.
See also
Search for resources using the Java API
Including AEM Forms Java library files
Repository Service API Quick Starts
Search for a resource by using the Repository service API (Java):
Include project files
Include client JAR files in your Java project’s class path.
Create the service client
Create a ResourceRepositoryClient
object by using its constructor and passing a ServiceClientFactory
object that contains connection properties.
Specify the target folder for the search
Specify the URI of the base path from which to execute the search. In this example, the URI of the resource is /testFolder
.
Specify the attributes used in the search
Specify the values for the attributes on which to conduct the search. The attributes exist within a com.adobe.repository.infomodel.bean.Resource
object. In this example, the search will be conducted on the name attribute; therefore, a java.lang.String
containing the Resource
object’s name is used, which is testResource
in this case.
Create the query used in the search
To create a query, create a com.adobe.repository.query.Query
object by invoking the default constructor for the Query
class and add statements to the query.
To create a statement, invoke the constructor for the com.adobe.repository.query.Query.Statement
class and pass in the following parameters:
Resource.ATTRIBUTE_NAME
is used.Query.Statement
class. In this example, the static value Query.Statement.OPERATOR_BEGINS_WITH
is used.String
containing the value "testResource"
, is used.Specify the namespace of the left operand by invoking the Query.Statement
object’s setNamespace
method and passing in one of the static values contained in the com.adobe.repository.infomodel.bean.ResourceProperty
class. In this example, ResourceProperty.RESERVED_NAMESPACE_REPOSITORY
is used.
Add each statement to the query by invoking the Query
object’s addStatement
method and passing in the Query.Statement
object.
Create the sort order for the search results
To specify the sort order used in the search results, create a com.adobe.repository.query.sort.SortOrder
object by invoking the default constructor for the SortOrder
class, and add elements to the sort order.
To create an element for the sort order, invoke one of the constructors for the com.adobe.repository.query.sort.SortOrder.Element
class. In this example, because the resource’s name is used as the basis for the search, the static value Resource.ATTRIBUTE_NAME
is used as the first parameter, and ascending order (a boolean
value of true
) is specified as the second parameter.
Add each element to the sort order by invoking the SortOrder
object’s addSortElement
method and passing in the SortOrder.Element
object.
Search for the resources
To search for resources
based on attribute properties, invoke the ResourceRepositoryClient
object’s searchProperties
method and pass in the following parameters:
String
containing the base path from which to execute the search. In this case, "/testFolder"
is used.com.adobe.repository.infomodel.bean.ResourceCollection.DEPTH_INFINITE
is used to indicate that the base path and all its folders are to be used.int
value indicating the first row from which to select the unpaged result set. In this example, 0
is specified.int
value indicating the maximum number of results to be returned. In this example, 10
is specified.The method returns a java.util.List
of Resource
objects in the specified sort order.
Retrieve the resources from the search result
To retrieve the resources contained in the search result, iterate through the List
and cast each object to a Resource
in order to extract its information. In this example, the name of each resource is displayed.
See also
Quick Start (SOAP mode): Searching for resources using the Java API
Including AEM Forms Java library files
You can specify relationships between resources in the repository. There are three kinds of relationships:
You can create your own custom relationships. For example, if you store an HTML file in the repository and it uses an image, you could specify a custom relationship to relate the HTML file with the image (since normally only XML files are associated with images using a repository-defined dependence relationship). Another example of a custom relationship would be if you wanted to build a different view of the repository with a cyclical graph structure instead of a tree structure. You could define a circular graph along with a viewer to traverse those relationships. Finally, you could indicate that a resource replaces another resource even though the two resources are completely different. In that case you could define a relationship type outside of the reserved range and create a relationship between those two resources. Your application would be the only client that could detect and process the relationship, and it could be used to conduct searches on that relationship.
You can programmatically specify relationships between resources by using the Repository service Java API or web service API.
For more information about the Repository service, see Services Reference for AEM Forms.
To specify a relationship between two resources, follow these steps:
Include project files
Include the necessary files in your development project. If you are creating a client application using Java, include the necessary JAR files. If you are using web services, include the proxy files.
Create the service client
Before you can programmatically read a resource, you must establish a connection and provide credentials. This is accomplished by creating a service client.
Specify the URIs of the resources to be related
Create strings containing the URIs of the resource to be related. The syntax includes forward slashes, as in this example: “/path/resource”.
Create the relationship
Invoke the Repository service method to create and specify the type of relationship.
See also
Create relationship resources using the Java API
Create relationship resources using the web service API
Including AEM Forms Java library files
Repository Service API Quick Starts
Create relationship resources by using the Repository service Java API, perform the following tasks:
Include project files
Include client JAR files in your Java project’s class path.
Create the service client
Create a ResourceRepositoryClient
object by using its constructor and passing a ServiceClientFactory
object that contains connection properties.
Specify the URIs of the resources to be related
Specify the URIs of the resources to be related. In this case, because the resources are named testResource1
and testResource2
and are located in the folder named testFolder
, their URIs are "/testFolder/testResource1"
and "/testFolder/testResource2"
. The URIs are stored as a java.lang.String
objects. In this example, the resources are first written to the repository, and their URIs are retrieved. For more information about writing a resource, see Writing Resources.
Create the relationship
Invoke the ResourceRepositoryClient
object’s createRelationship
method and pass in the following parameters:
com.adobe.repository.infomodel.bean.Relation
class. In this example, a dependence relationship is established by specifying the value Relation.TYPE_DEPENDANT_OF
.boolean
value indicating whether the target resource is automatically updated to the com.adobe.repository.infomodel.Id
-based identifier of the new head resource. In this example, because of the dependence relationship, the value true
is specified.You can also retrieve a list of related resources for a given resource by invoking the ResourceRepositoryClient
object’s getRelated
method and passing in the following parameters:
"/testFolder/testResource1"
) is specified.boolean
value indicating whether the specified resource is the source resource in the relationship. In this example, the value true
is specified because this is the case.Relation
class. In this example, a dependence relationship is specified by using the same value used earlier: Relation.TYPE_DEPENDANT_OF
.The getRelated
method returns a java.util.List
of Resource
objects through which you can iterate to retrieve each of the related resources, casting the objects contained in the List
to Resource
as you do so. In this example, testResource2
is expected to be in the list of returned resources.
See also
Creating Resource Relationships
Quick Start (SOAP mode): Creating relationships between resources using the Java API
Including AEM Forms Java library files
Create relationship resources by using the Repository API (web service):
Include project files
Create the service client
Using the Microsoft .NET client assembly, create a RepositoryServiceService
object by invoking its default constructor. Set its Credentials
property using a System.Net.NetworkCredential
object containing the user name and password.
Specify the URIs of the resources to be related
Specify the URIs of the resources to be related. In this case, because the resources are named testResource1
and testResource2
and are located in the folder named testFolder
, their URIs are "/testFolder/testResource1"
and "/testFolder/testResource2"
. When using a language compliant with the Microsoft .NET Framework (for example, C#), the URIs are stored as a System.String
objects. In this example, the resources are first written to the repository, and their URIs are retrieved. For more information about writing a resource, see Writing Resources.
Create the relationship
Invoke the RepositoryServiceService
object’s createRelationship
method and pass in the following parameters:
3
.boolean
value indicating whether the relationship type was specified. In this example, the value true
is specified.boolean
value indicating whether the target resource is automatically updated to the Id
-based identifier of the new head resource. In this example, because of the dependence relationship, the value true
is specified.boolean
value indicating whether the target head was specified. In this example, the value true
is specified.null
for the last parameter.You can also retrieve a list of related resources for a given resource by invoking the RepositoryServiceService
object’s getRelated
method and passing in the following parameters:
"/testFolder/testResource1"
) is specified.boolean
value indicating whether the specified resource is the source resource in the relationship. In this example, the value true
is specified because this is the case.boolean
value indicating whether the source resource was specified. In this example, the value true
is provided.3
.null
for the remaining two parameters.The getRelated
method returns an array of objects that can be cast to Resource
objects through which you can iterate to retrieve each of the related resources. In this example, testResource2
is expected to be in the list of returned resources.
See also
Creating Resource Relationships
Invoking AEM Forms using Base64 encoding
You can lock a resource or set of resources for exclusive use by a particular user or shared use among more than one user. A shared lock is an indication that something will happen with the resource, but it does not prevent anyone else from taking actions with that resource. A shared lock should be considered a signaling mechanism. An exclusive lock means that the user who locked the resource is going to change the resource, and the lock ensures that nobody else can do so until the user no longer needs access to the resource and has released the lock. If a repository administrator unlocks a resource, all exclusive and shared locks on that resource will automatically be removed. This type of action is meant for situations in which a user is no longer available and has not unlocked the resource.
When a resource is locked, a lock icon appears when you view the Resources tab located in Workbench, as shown in the following illustration.
You can programmatically control access to resources by using the Repository service Java API or web service API.
For more information about the Repository service, see Services Reference for AEM Forms.
To lock and unlock resources, follow these steps:
Include project files
Include the necessary files in your development project. If you are creating a client application using Java, include the necessary JAR files. If you are using web services, include the proxy files.
Create the service client
Before you can programmatically read a resource, you must establish a connection and provide credentials. This is accomplished by creating a service client.
Specify the URI of the resource to be locked
Create a string containing the URI of the resource to be locked. The syntax includes forward slashes, as in this example: “/path/resource”.
Lock the resource
Invoke the Repository service method to lock the resource, specifying the URI, the type of lock, and the locking depth.
Retrieve the locks for the resource
Invoke the Repository service method to retrieve the locks for the resource, specifying the URI.
Unlock the resource
Invoke the Repository service method to unlock the resource, specifying the URI.
See also
Lock resources using the Java API
Lock resources using the web service API
Including AEM Forms Java library files
Repository Service API Quick Starts
Lock resources by using the Repository service API (Java):
Include project files
Include client JAR files in your Java project’s class path.
Create the service client
Create a ResourceRepositoryClient
object by using its constructor and passing a ServiceClientFactory
object that contains connection properties.
Specify the URI of the resource to be locked
Specify the URI of the resource to be locked. In this case, because the resource named testResource
is in the folder named testFolder
, its URI is "/testFolder/testResource"
. The URI is stored as a java.lang.String
object.
Lock the resource
Invoke the ResourceRepositoryClient
object’s lockResource
method and pass in the following parameters:
com.adobe.repository.infomodel.bean.Lock.SCOPE_EXCLUSIVE
.Lock.DEPTH_ZERO
.The overloaded version of the lockResource
method that requires four parameters throws an exception. Ensure to use the lockResource
method that requires three parameters as shown in this walkthrough.
Retrieve the locks for the resource
Invoke the ResourceRepositoryClient
object’s getLocks
method and pass the URI of the resource as a parameter. The method returns a List of Lock objects through which you can iterate. In this example, the lock owner, depth, and scope are printed for each object by invoking each Lock object’s getOwnerUserId
, getDepth
, and getType
methods, respectively.
Unlock the resource
Invoke the ResourceRepositoryClient
object’s unlockResource
method and pass the URI of the resource as a parameter. For more information, see the AEM Forms API Reference.
See also
Quick Start (SOAP mode): Locking a resource using the Java API
Including AEM Forms Java library files
Lock resources by using the Repository service API (web service):
Include project files
Create the service client
Using the Microsoft .NET client assembly, create a RepositoryServiceService
object by invoking its default constructor. Set its Credentials
property using a System.Net.NetworkCredential
object containing the user name and password.
Specify the URI of the resource to be locked
Specify a string containing the URI of the resource to be locked. In this case, because the resource named testResource
is in the folder testFolder
, its URI is "/testFolder/testResource"
. When using a language compliant with the Microsoft .NET Framework (for example, C#), store the URI in a System.String
object.
Lock the resource
Invoke the RepositoryServiceService
object’s lockResource
method and pass in the following parameters:
11
.2
.int
value indicating the number of seconds until the lock expires. In this example, the value of 1000
is used.null
for the last parameter.Retrieve the locks for the resource
Invoke the RepositoryServiceService
object’s getLocks
method and pass the URI of the resource as the first parameter and null
for the second parameter. The method returns an object
array containing Lock
objects through which you can iterate. In this example, the lock owner, depth, and scope are printed for each object by accessing each Lock
object’s ownerUserId
, depth
, and type
fields, respectively.
Unlock the resource
Invoke the RepositoryServiceService
object’s unlockResource
method and pass the URI of the resource as the first parameter and null
for the second parameter.
See also
Invoking AEM Forms using Base64 encoding
You can programmatically delete resources from a given location in the repository by using the Repository service Java API(SOAP).
When you delete a resource, the deletion is normally permanent, though in some cases ECM repositories may store the versions of the resource according to their history mechanisms. Therefore, when deleting a resource, it is important to be sure that you will never need that resource again. The common reasons for deleting a resource include the need to increase the available space in the database. You can delete a version of a resource, but if you do so you must specify the resource identifier, and not its logical identifier (LID) or path. If you delete a folder, everything in that folder, including subfolders and resources, will be automatically deleted.
Related resources are not deleted. For example, if you have a form that uses the logo.gif file, and you delete logo.gif, a relationship will be stored in the pending relationship table. As an alternative, for version deprecation, set the object status of the latest version to deprecated.
A deletion operation is not transaction-safe in ECM systems. For example, if you attempt to delete 100 resources and the operation fails on the 50th resource, the first 49 instances will be deleted but the rest will not be. Otherwise, the default behavior is rollback (non-commitment).
When using the com.adobe.repository.bindings.dsc.client.ResourceRepositoryClient.deleteResources()
method with ECM repository (EMC Documentum Content Server and IBM FileNet P8 Content Manager), the transaction will not be rolled back if the deletion fails for one of the specified resources, which means that those files that have been deleted cannot be undeleted.
For more information about the Repository service, see Services Reference for AEM Forms.
To delete a resource, follow these steps:
Include project files
Include the necessary files in your development project. If you are creating a client application using Java, include the necessary JAR files. If you are using web services, include the proxy files.
Create the service client
Before you can programmatically read a resource, you must establish a connection and provide credentials. This is accomplished by creating a service client.
Specify the URI of the resource to be deleted
Create a string containing the URI of the resource to be deleted. The syntax includes forward slashes, as in this example: “/path/resource”. If the resource to be deleted is a folder, the deletion will be recursive.
Delete the resource
Invoke the Repository service method to delete the resource, specifying the URI.
See also
Delete resources using the Java API
Delete resources using the web service API
Including AEM Forms Java library files
Repository Service API Quick Starts
Delete a resource by using the Repository API (Java):
Include project files
Include client JAR files in your Java project’s class path.
Create the service client
Create a ResourceRepositoryClient
object by using its constructor and passing a ServiceClientFactory
object that contains connection properties.
Specify the URI of the resource to be deleted
Specify the URI of the resource to be retrieved. In this case, because the resource named testResourceToBeDeleted is in the folder named testFolder, its URI is /testFolder/testResourceToBeDeleted
. The URI is stored as a java.lang.String
object. In this example, the resource is first written to the repository, and its URI is retrieved. For more information about writing a resource, see Writing Resources.
Delete the resource
Invoke the ResourceRepositoryClient
object’s deleteResource
method and pass the URI of the resource as a parameter.
See also
Quick Start (SOAP mode): Searching for resources using the Java API
Including AEM Forms Java library files
Delete a resource by using the Repository API (web service):
Include project files
Create the service client
Using the Microsoft .NET client assembly, create a RepositoryServiceService
object by invoking its default constructor. Set its Credentials
property using a System.Net.NetworkCredential
object containing the user name and password.
Specify the URI of the resource to be deleted
Specify the URI of the resource to be retrieved. In this case, because the resource named testResourceToBeDeleted
is in the folder named testFolder
, its URI is "/testFolder/testResourceToBeDeleted"
. In this example, the resource is first written to the repository, and its URI is retrieved. For more information about writing a resource, see Writing Resources.
Delete the resource
Invoke the RepositoryServiceService
object’s deleteResources
method and pass a System.String
array containing the URI of the resource as the first parameter. Pass null
for the second parameter.
See also
Invoking AEM Forms using Base64 encoding