Class ImportEntryBuilder
- java.lang.Object
-
- org.openbravo.service.importprocess.ImportEntryBuilder
-
public class ImportEntryBuilder extends Object
Builder class used to easily create a new ImportEntry instance
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description ImportEntry
create()
Creates a ImportEntry instance, checks that this instance is not already created or archived and then saves it.static ImportEntryBuilder
newInstance(String typeOfData, String jsonData)
Create a new instance of the Builder to create a new ImportEntry.ImportEntryBuilder
setClient(Client client)
ImportEntryBuilder
setId(String id)
ImportEntryBuilder
setIsNonBlocking(boolean isNonBlocking)
Set this flag to true to mark the ImportEntry as a nonBlocking oneImportEntryBuilder
setNotifyManager(boolean notifyManager)
Set this flag to true to notify the ImportEntryManager there is a new ImportEntry to processImportEntryBuilder
setOrganization(Organization organization)
ImportEntryBuilder
setProperty(String propertyName, Object propertyValue)
This method let initialize any ImportEntry property using its property name.ImportEntryBuilder
setRole(Role role)
-
-
-
Method Detail
-
newInstance
public static ImportEntryBuilder newInstance(String typeOfData, String jsonData)
Create a new instance of the Builder to create a new ImportEntry. Both the typeOfData and jsonData values are mandatory.- Parameters:
typeOfData
- Type of data. It must be a valid list reference value within the reference: 'Type of Import Data'jsonData
- String representation of a JSONObject with the content to distribute- Returns:
- A new ImportEntryBuilder instance with typeOfData and jsonData values set
-
setId
public ImportEntryBuilder setId(String id)
-
setOrganization
public ImportEntryBuilder setOrganization(Organization organization)
-
setClient
public ImportEntryBuilder setClient(Client client)
-
setRole
public ImportEntryBuilder setRole(Role role)
-
setProperty
public ImportEntryBuilder setProperty(String propertyName, Object propertyValue)
This method let initialize any ImportEntry property using its property name. Note that if propertyName does not exist for ImportEntry, create() will throw an OBException. Also, if propertyValue cannot be assigned to the property, a ValidationException will be thrown.- Parameters:
propertyName
- the name of the propertypropertyValue
- the value of the property- Returns:
- The ImportEntryBuilder instance to chain another method
-
setNotifyManager
public ImportEntryBuilder setNotifyManager(boolean notifyManager)
Set this flag to true to notify the ImportEntryManager there is a new ImportEntry to process- Parameters:
notifyManager
- whether ImportEntryManager.notifyNewImportEntryCreated() will be called after ImportEntry creation- Returns:
- The ImportEntryBuilder instance to chain another method
-
setIsNonBlocking
public ImportEntryBuilder setIsNonBlocking(boolean isNonBlocking)
Set this flag to true to mark the ImportEntry as a nonBlocking one- Parameters:
isNonBlocking
- whether the ImportEntry is or not NonBlocking- Returns:
- The ImportEntryBuilder instance to chain another method
-
create
public ImportEntry create()
Creates a ImportEntry instance, checks that this instance is not already created or archived and then saves it. If setNotifyManager(true) is called, the transaction is commited, the connection closed and the ImportEntryManager will be notified of the change.- Throws:
ImportEntryAlreadyExistsException
- when import entry already exists either in c_import_entry or c_import_entry_archive tablesOBException
- when data provided is not valid. This could be caused because: Client/Organization does not match, role is not part of client or attempting to insert a non-existing custom property
-
-