public class StemSave extends Object
Use this class to insert or update a stem
Sample call
StemSave stemSave = new StemSave(grouperSession).assignName("test") .assignCreateParentStemsIfNotExist(true).assignDisplayName("test") .assignDescription("testDescription"); Stem stem = stemSave.save(); System.out.println(stemSave.getSaveResultType()); // DELETE, INSERT, NO_CHANGE, or UPDATE
Sample to delete
new StemSave(grouperSession).assignUuid(stem.getId()).assignSaveMode(SaveMode.DELETE).save();
To edit just one field (the description) for existing stem
new StemSave(grouperSession).assignUuid(stem.getId()) .assignDisplayExtension("test1") .assignAlternateName("newAlternateName") .assignReplaceAllSettings(false).save();
Constructor and Description |
---|
StemSave()
create a new stem save
|
StemSave(GrouperSession theGrouperSession)
create a new stem save
|
Modifier and Type | Method and Description |
---|---|
StemSave |
assignAlternateName(String theAlternateName)
assign alternateName
|
StemSave |
assignCreateParentStemsIfNotExist(boolean theCreateParentStemsIfNotExist)
assign create parents if not exist
|
StemSave |
assignDescription(String theDescription)
assign description
|
StemSave |
assignDisplayExtension(String theDisplayExtension)
display extension
|
StemSave |
assignDisplayName(String theDisplayName) |
StemSave |
assignIdIndex(Long theIdIndex)
assign id_index
|
StemSave |
assignName(String name1)
name
|
StemSave |
assignReplaceAllSettings(boolean theReplaceAllSettings)
replace all existing settings.
|
StemSave |
assignRunAsRoot(boolean runAsRoot)
set this to true to run as a root session
|
StemSave |
assignSaveMode(SaveMode theSaveMode)
asssign save mode
|
StemSave |
assignSetAlternateNameIfRename(boolean theSetAlternateNameIfRename)
whether an alternate name should automatically be assigned if doing a rename
|
StemSave |
assignStemNameToEdit(String theStemNameToEdit)
stem name to edit
|
StemSave |
assignUuid(String theUuid)
uuid
|
SaveResultType |
getSaveResultType()
get the save type
|
Stem |
save()
create or update a stem.
|
Stem |
saveUnchecked()
Deprecated.
|
public StemSave()
theGrouperSession
- public StemSave(GrouperSession theGrouperSession)
theGrouperSession
- public StemSave assignReplaceAllSettings(boolean theReplaceAllSettings)
public StemSave assignRunAsRoot(boolean runAsRoot)
runAsRoot
- public StemSave assignIdIndex(Long theIdIndex)
theIdIndex
- public StemSave assignStemNameToEdit(String theStemNameToEdit)
theStemNameToEdit
- public StemSave assignDisplayExtension(String theDisplayExtension)
theDisplayExtension
- public StemSave assignDescription(String theDescription)
theDescription
- public StemSave assignAlternateName(String theAlternateName)
theAlternateName
- public StemSave assignSetAlternateNameIfRename(boolean theSetAlternateNameIfRename)
theSetAlternateNameIfRename
- public StemSave assignSaveMode(SaveMode theSaveMode)
theSaveMode
- public StemSave assignCreateParentStemsIfNotExist(boolean theCreateParentStemsIfNotExist)
theCreateParentStemsIfNotExist
- public SaveResultType getSaveResultType()
@Deprecated public Stem saveUnchecked()
create or update a stem. Note this will not move a stem at this time (might in future) This is a static method since setters to Stem objects persist to the DB Steps: 1. Find the stem by stemNameToEdit (if not there then its an insert) 2. Internally set all the fields of the stem (no need to reset if already the same) 3. Store the stem (insert or update) if needed 4. Return the stem object This occurs in a transaction, so if a part of it fails, it rolls back, and potentially rolls back outer transactions too
public Stem save() throws StemNotFoundException, InsufficientPrivilegeException, StemAddException, StemModifyException
create or update a stem. Note this will not move a stem at this time (might in future) This is a static method since setters to Stem objects persist to the DB Steps: 1. Find the stem by stemNameToEdit (if not there then its an insert) 2. Internally set all the fields of the stem (no need to reset if already the same) 3. Store the stem (insert or update) if needed 4. Return the stem object This occurs in a transaction, so if a part of it fails, it rolls back, and potentially rolls back outer transactions too
StemNotFoundException
InsufficientPrivilegeException
StemAddException
StemModifyException
Copyright © 2016 Internet2. All rights reserved.