Class EntitySave

java.lang.Object
edu.internet2.middleware.grouper.entity.EntitySave

public class EntitySave extends Object
Use this class to insert or update an entity
  • Constructor Details

    • EntitySave

      public EntitySave(GrouperSession theGrouperSession)
      create a new entity save
      Parameters:
      theGrouperSession -
  • Method Details

    • assignEntityNameToEdit

      public EntitySave assignEntityNameToEdit(String theGroupNameToEdit)
      group name to edit
      Parameters:
      theGroupNameToEdit -
      Returns:
      the group name to edit
    • assignUuid

      public EntitySave assignUuid(String theUuid)
      uuid
      Parameters:
      theUuid -
      Returns:
      uuid
    • assignDisplayName

      public EntitySave assignDisplayName(String theDisplayName)
      Parameters:
      theDisplayName -
      Returns:
      this for chaining
    • assignName

      public EntitySave assignName(String name1)
      name
      Parameters:
      name1 -
      Returns:
      name
    • assignDisplayExtension

      public EntitySave assignDisplayExtension(String theDisplayExtension)
      display extension
      Parameters:
      theDisplayExtension -
      Returns:
      this for chaining
    • assignDescription

      public EntitySave assignDescription(String theDescription)
      assign description
      Parameters:
      theDescription -
      Returns:
      this for chaining
    • assignSaveMode

      public EntitySave assignSaveMode(SaveMode theSaveMode)
      assign save mode
      Parameters:
      theSaveMode -
      Returns:
      this for chaining
    • assignCreateParentStemsIfNotExist

      public EntitySave assignCreateParentStemsIfNotExist(boolean theCreateParentStemsIfNotExist)
      assign create parents if not exist
      Parameters:
      theCreateParentStemsIfNotExist -
      Returns:
      this for chaining
    • getSaveResultType

      public SaveResultType getSaveResultType()
      get the save type
      Returns:
      save type
    • save

      public Entity save()
       create or update a group.  Note this will not rename a group at this time (might in future)
       
       This is a static method since setters to Group objects persist to the DB
       
       Steps:
       
       1. Find the group by groupNameToEdit
       2. Internally set all the fields of the stem (no need to reset if already the same)
       3. Store the group (insert or update) if needed
       4. Return the group object
       
       This runs in a tx so that if part of it fails the whole thing fails, and potentially the outer
       transaction too
       
      Returns:
      the group
      Throws:
      StemNotFoundException
      InsufficientPrivilegeException
      StemAddException
      GroupModifyException
      GroupNotFoundException
      GroupAddException