Interface SubjectAdminSession
- All Superinterfaces:
AutoCloseable, Closeable, OsidSession, OsidSession
- All Known Subinterfaces:
SubjectBatchAdminSession
This session creates, updates, and deletes Subjects . 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
Subject , a SubjectForm is requested using
getSubjectFormForCreate() specifying the desired record Types or
none if no record Types are needed. The returned
SubjectForm 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 SubjectForm is submiited to a create operation, it cannot
be reused with another create operation unless the first operation was
unsuccessful. Each SubjectForm corresponds to an attempted
transaction.
For updates, SubjectForms are requested to the Subject
Id that is to be updated using getSubjectFormForUpdate() .
Similarly, the SubjectForm has metadata about the data that can be
updated and it can perform validation before submitting the update. The
SubjectForm can only be used once for a successful update and
cannot be reused.
The delete operations delete Subjects . To unmap a
Subject from the current Ontology , the
SubjectOntologyAssignmentSession should be used. These delete operations
attempt to remove the Subject itself thus removing it from all
known Ontology catalogs.
This session includes an Id aliasing mechanism to assign an
external Id to an internally assigned Id.
-
Method Summary
Modifier and TypeMethodDescriptionvoidaliasSubject(Id subjectId, Id aliasId) Adds anIdto aSubjectfor the purpose of creating compatibility.booleanTests if this user can createSubjects.booleancanCreateSubjectWithRecordTypes(Type[] subjectRecordTypes) Tests if this user can create a singleSubjectusing the desired record interface types.booleanTests if this user can deleteSubjects.booleanTests if this user can manageIdaliases forSubjects.booleanTests if this user can updateSubjects.createSubject(SubjectForm subjectForm) Creates a newSubject.voiddeleteSubject(Id subjectId) Deletes theSubjectidentified by the givenId.Gets theOntologyassociated with this session.Gets theOntologyIdassociated with this session.getSubjectFormForCreate(Type[] subjectRecordTypes) Gets the subject form for creating new subjects.getSubjectFormForUpdate(Id subjectId) Gets the subject form for updating an existing subject.voidupdateSubject(SubjectForm subjectForm) Updates an existing subject.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
-
getOntologyId
Id getOntologyId()Gets theOntologyIdassociated with this session.- Returns:
- the
Ontology Idassociated with this session - Compliance:
mandatory- This method must be implemented.
-
getOntology
Gets theOntologyassociated with this session.- Returns:
- the
Ontologyassociated with this session - Throws:
OperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
canCreateSubjects
boolean canCreateSubjects()Tests if this user can createSubjects. A return of true does not guarantee successful authorization. A return of false indicates that it is known creating a subject will result in aPERMISSION_DENIED. This is intended as a hint to an application that may opt not to offer create operations to an unauthorized user.- Returns:
falseifSubjectcreation is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
canCreateSubjectWithRecordTypes
Tests if this user can create a singleSubjectusing the desired record interface types. WhileOntologyManager.getSubjectRecordTypes()can be used to examine which record interfaces are supported, this method tests which record(s) are required for creating a specificSubject. Providing an empty array tests if aSubjectcan be created with no records.- Parameters:
subjectRecordTypes- array of subject record types- Returns:
trueifSubjectcreation using the specified recordTypesis supported,falseotherwise- Throws:
NullArgumentException-subjectRecordTypesisnull- Compliance:
mandatory- This method must be implemented.
-
getSubjectFormForCreate
SubjectForm getSubjectFormForCreate(Type[] subjectRecordTypes) throws OperationFailedException, PermissionDeniedException Gets the subject form for creating new subjects. A new form should be requested for each create transaction.- Parameters:
subjectRecordTypes- array of subject record types- Returns:
- the subject form
- Throws:
NullArgumentException-subjectRecordTypesisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException- unable to get form for requested record types- Compliance:
mandatory- This method must be implemented.
-
createSubject
Subject createSubject(SubjectForm subjectForm) throws OperationFailedException, PermissionDeniedException Creates a newSubject.- Parameters:
subjectForm- the form for thisSubject- Returns:
- the new
Subject - Throws:
IllegalStateException-subjectFormalready used in a create transactionInvalidArgumentException- one or more of the form elements is invalidNullArgumentException-subjectFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-subjectFormdid not originate fromgetSubjectFormForCreate()- Compliance:
mandatory- This method must be implemented.
-
canUpdateSubjects
boolean canUpdateSubjects()Tests if this user can updateSubjects. A return of true does not guarantee successful authorization. A return of false indicates that it is known updating aSubjectwill result in aPERMISSION_DENIED. This is intended as a hint to an application that may opt not to offer update operations to an unauthorized user.- Returns:
falseif subject modification is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
getSubjectFormForUpdate
SubjectForm getSubjectFormForUpdate(Id subjectId) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the subject form for updating an existing subject. A new subject form should be requested for each update transaction.- Parameters:
subjectId- theIdof theSubject- Returns:
- the subject form
- Throws:
NotFoundException-subjectIdis not foundNullArgumentException-subjectIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
updateSubject
void updateSubject(SubjectForm subjectForm) throws OperationFailedException, PermissionDeniedException Updates an existing subject.- Parameters:
subjectForm- the form containing the elements to be updated- Throws:
IllegalStateException-subjectFormalready used in an update transactionInvalidArgumentException- the form contains an invalid valueNullArgumentException-subjectFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-subjectFormdid not originate fromgetSubjectFormForUpdate()- Compliance:
mandatory- This method must be implemented.
-
canDeleteSubjects
boolean canDeleteSubjects()Tests if this user can deleteSubjects. A return of true does not guarantee successful authorization. A return of false indicates that it is known deleting aSubjectwill result in aPERMISSION_DENIED. This is intended as a hint to an application that may opt not to offer delete operations to an unauthorized user.- Returns:
falseifSubjectdeletion is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
deleteSubject
void deleteSubject(Id subjectId) throws NotFoundException, OperationFailedException, PermissionDeniedException Deletes theSubjectidentified by the givenId.- Parameters:
subjectId- theIdof theSubjectto delete- Throws:
NotFoundException- aSubjectwas not found identified by the givenIdNullArgumentException-subjectIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
canManageSubjectAliases
boolean canManageSubjectAliases()Tests if this user can manageIdaliases forSubjects. 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:
falseifSubjectaliasing is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
aliasSubject
void aliasSubject(Id subjectId, Id aliasId) throws AlreadyExistsException, NotFoundException, OperationFailedException, PermissionDeniedException Adds anIdto aSubjectfor the purpose of creating compatibility. The primaryIdof theSubjectis determined by the provider. The newIdperforms as an alias to the primaryId. If the alias is a pointer to another subject, it is reassigned to the given subjectId.- Parameters:
subjectId- theIdof aSubjectaliasId- the aliasId- Throws:
AlreadyExistsException-aliasIdis already assignedNotFoundException-subjectIdnot foundNullArgumentException-subjectIdoraliasIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-