Interface FamilyAdminSession
- All Superinterfaces:
AutoCloseable, Closeable, OsidSession, OsidSession
- All Known Subinterfaces:
FamilyBatchAdminSession
This session creates, updates, and deletes Families . The data
for create and update is provided by the consumer via the form object.
OsidForms are requested for each create or update and may not be
reused.
Create and update operations differ in their usage. To create a
Family , a FamilyForm is requested using
getFamilyFormForCreate() specifying the desired record Types or
none if no record Types are needed. The returned
FamilyForm will indicate that it is to be used with a create operation
and can be used to examine metdata or validate data prior to creation.
Once the FamilyForm is submiited to a create operation, it cannot
be reused with another create operation unless the first operation was
unsuccessful. Each FamilyForm corresponds to an attempted
transaction.
For updates, FamilyForms are requested to the Family
Id that is to be updated using getFamilyFormForUpdate() .
Similarly, the FamilyForm has metadata about the data that can be
updated and it can perform validation before submitting the update. The
FamilyForm can only be used once for a successful update and
cannot be reused.
The delete operations delete Families .
This session includes an Id aliasing mechanism to assign an
external Id to an internally assigned Id.
-
Method Summary
Modifier and TypeMethodDescriptionvoidaliasFamily(Id familyId, Id aliasId) Adds anIdto aFamilyfor the purpose of creating compatibility.booleanTests if this user can create families.booleancanCreateFamilyWithRecordTypes(Type[] familyRecordTypes) Tests if this user can create a singleFamilyusing the desired record types.booleanTests if this user can delete families.booleanTests if this user can manageIdaliases for families.booleanTests if this user can update families.createFamily(FamilyForm familyForm) Creates a newFamily.voiddeleteFamily(Id familyId) Deletes aFamily.getFamilyFormForCreate(Type[] familyRecordTypes) Gets the family form for creating new families.getFamilyFormForUpdate(Id familyId) Gets the family form for updating an existing family.voidupdateFamily(FamilyForm familyForm) Updates an existing family.Methods inherited from interface OsidSession
closeMethods inherited from interface OsidSession
getAuthenticatedAgent, getAuthenticatedAgentId, getClockRate, getDate, getEffectiveAgent, getEffectiveAgentId, getFormatType, getLocale, isAuthenticated, startTransaction, supportsTransactionsModifier and TypeMethodDescriptionGets the agent authenticated to this session.Gets theIdof the agent authenticated to this session.Gets the rate of the service clock.getDate()Gets the service date which may be the current date or the effective date in which this session exists.Gets the effective agent in use by this session.Gets theIdof the effective agent in use by this session.Gets theDisplayTextformatTypepreference in effect for this session.Gets the locale indicating the localization preferences in effect for this session.booleanTests if an agent is authenticated to this session.Starts a new transaction for this sesson.booleanTests for the availability of transactions.
-
Method Details
-
canCreateFamilies
boolean canCreateFamilies()Tests if this user can create families. A return of true does not guarantee successful authorization. A return of false indicates that it is known creating aFamilywill result in aPERMISSION_DENIED. This is intended as a hint to an application that may not wish to offer create operations to unauthorized users.- Returns:
falseifFamilycreation is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
canCreateFamilyWithRecordTypes
Tests if this user can create a singleFamilyusing the desired record types. WhileRelationshipManager.getFamilyRecordTypes()can be used to examine which records are supported, this method tests which record(s) are required for creating a specificFamily. Providing an empty array tests if aFamilycan be created with no records.- Parameters:
familyRecordTypes- array of family record types- Returns:
trueifFamilycreation using the specified recordTypesis supported,falseotherwise- Throws:
NullArgumentException-familyRecordTypes is null- Compliance:
mandatory- This method must be implemented.
-
getFamilyFormForCreate
FamilyForm getFamilyFormForCreate(Type[] familyRecordTypes) throws OperationFailedException, PermissionDeniedException Gets the family form for creating new families. A new form should be requested for each create transaction.- Parameters:
familyRecordTypes- array of family record types- Returns:
- the family form
- Throws:
NullArgumentException-familyRecordTypes is nullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException- unable to get form for requested record types- Compliance:
mandatory- This method must be implemented.
-
createFamily
Family createFamily(FamilyForm familyForm) throws OperationFailedException, PermissionDeniedException Creates a newFamily.- Parameters:
familyForm- the form for thisFamily.- Returns:
- the new
Family - Throws:
IllegalStateException-familyFormalready used in a create transactionInvalidArgumentException- one or more of the form elements is invalidNullArgumentException-familyFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-familyFormdid not originate fromgetFamilyFormForCreate()- Compliance:
mandatory- This method must be implemented.
-
canUpdateFamilies
boolean canUpdateFamilies()Tests if this user can update families. A return of true does not guarantee successful authorization. A return of false indicates that it is known updating aFamilywill result in aPERMISSION_DENIED. This is intended as a hint to an application that may not wish to offer update operations to unauthorized users.- Returns:
falseifFamilymodification is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
getFamilyFormForUpdate
FamilyForm getFamilyFormForUpdate(Id familyId) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the family form for updating an existing family. A new family form should be requested for each update transaction.- Parameters:
familyId- theIdof theFamily- Returns:
- the family form
- Throws:
NotFoundException-familyIdis not foundNullArgumentException-familyIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
updateFamily
Updates an existing family.- Parameters:
familyForm- the form containing the elements to be updated- Throws:
IllegalStateException-familyFormalready used in an update transactionInvalidArgumentException- the form contains an invalid valueNullArgumentException-familyIdorfamilyFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-familyFormdid not originate fromgetFamilyFormForUpdate()- Compliance:
mandatory- This method must be implemented.
-
canDeleteFamilies
boolean canDeleteFamilies()Tests if this user can delete families. A return of true does not guarantee successful authorization. A return of false indicates that it is known deleting aFamilywill result in aPERMISSION_DENIED. This is intended as a hint to an application that may not wish to offer delete operations to unauthorized users.- Returns:
falseifFamilydeletion is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
deleteFamily
void deleteFamily(Id familyId) throws NotFoundException, OperationFailedException, PermissionDeniedException Deletes aFamily.- Parameters:
familyId- theIdof theFamilyto remove- Throws:
NotFoundException-familyIdnot foundNullArgumentException-familyIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
canManageFamilyAliases
boolean canManageFamilyAliases()Tests if this user can manageIdaliases for families. A return of true does not guarantee successful authorization. A return of false indicates that it is known changing an alias will result in aPERMISSION_DENIED. This is intended as a hint to an application that may opt not to offer alias operations to an unauthorized user.- Returns:
falseifFamilyaliasing is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
aliasFamily
void aliasFamily(Id familyId, Id aliasId) throws AlreadyExistsException, NotFoundException, OperationFailedException, PermissionDeniedException Adds anIdto aFamilyfor the purpose of creating compatibility. The primaryIdof theFamilyis determined by the provider. The newIdperforms as an alias to the primaryId. If the alias is a pointer to another family, it is reassigned to the given familyId.- Parameters:
familyId- theIdof aFamilyaliasId- the aliasId- Throws:
AlreadyExistsException-aliasIdis already assignedNotFoundException-familyIdnot foundNullArgumentException-familyIdoraliasIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-