Package dev.getelements.elements.sdk.dao
Interface ApplicationDao
- All Known Implementing Classes:
MongoApplicationDao
public interface ApplicationDao
Created by patricktwohig on 7/10/15.
-
Method Summary
Modifier and TypeMethodDescriptioncreateOrUpdateInactiveApplication
(Application application) Creates a new application and inserts it into the database.findActiveApplication
(String nameOrId) Finds an activeApplication
with the supplied name or id.default Application
getActiveApplication
(String nameOrId) Gets an application with the specific name or identifier.Gets all active applications.getActiveApplications
(int offset, int count) Gets the active applications registered in the databse given the offset and count.getActiveApplications
(int offset, int count, String search) Gets the active applications registered in the databse given the offset and count.getActiveApplicationWithoutAttributes
(String nameOrId) Extension of getActiveApplication with no attributes set.void
softDeleteApplication
(String nameOrId) Deletes an Application with the specific name or identifier.updateActiveApplication
(String nameOrId, Application application) Updates an application with the specific name/identifiers.
-
Method Details
-
createOrUpdateInactiveApplication
Creates a new application and inserts it into the database. The returned value represents theApplication
as it was inserted into the database.If the existing
Application
objects is int eh database however is flagged as hidden or inactive this will simply reinstate the old record.- Parameters:
application
- the application- Returns:
- the application instance as it was created
-
getActiveApplications
Pagination<Application> getActiveApplications()Gets all active applications.- Returns:
- a
Pagination<Application>
of all activeApplication
instances
-
getActiveApplications
Gets the active applications registered in the databse given the offset and count.- Parameters:
offset
- the offsetcount
- the count- Returns:
- a
Pagination
ofApplication
instances
-
getActiveApplications
Gets the active applications registered in the databse given the offset and count.- Parameters:
offset
- the offsetcount
- the countsearch
- a query to filter the results- Returns:
- a
Pagination
ofApplication
instances
-
getActiveApplication
Gets an application with the specific name or identifier. This will throw an instance ofNotFoundException
if the object cannot be found, or is inactive.- Returns:
- an Application instance, never null
- Throws:
NotFoundException
- if the application is inactive or non-existent
-
findActiveApplication
Finds an activeApplication
with the supplied name or id.- Parameters:
nameOrId
- the name or id- Returns:
- an
Optional
of theApplication
-
getActiveApplicationWithoutAttributes
Extension of getActiveApplication with no attributes set. ofNotFoundException
if the object cannot be found, or is inactive.- Returns:
- an Application instance, never null
- Throws:
NotFoundException
- if the application is inactive or non-existent
-
updateActiveApplication
Updates an application with the specific name/identifiers. When changing the application name the ID must be specified.- Parameters:
nameOrId
- the name, or idapplication
- theApplication
object to write- Returns:
- the
Application
object as it was persisted to the database. - Throws:
NotFoundException
- if the application does not exist.
-
softDeleteApplication
Deletes an Application with the specific name or identifier. The application is no actually removed, but rather it is flagged as inactive to preserve any consistency with dependent data.- Parameters:
nameOrId
- the name, or id
-