See: Description
Interface | Description |
---|---|
AdministeredItemResult |
Represents the common result for the data model service execution.
|
ExcelImportDataError |
Represents the detailed information for each import error.
|
ExcelImportResult |
Represents the result of the Import Excel service.
|
ExportResult |
Represents the result of the Export service.
|
IGovServiceResult | Deprecated
From 1.7.0, please use the new API
ServiceResult instead. |
MetadataCreationResult |
Represents the result of a manually created Administered Item.
|
Service<S extends ServiceSpec,R extends ServiceResult> |
Defines a service.
|
Service.CreateAdministeredItems |
The Create Administered Items service.
|
Service.DeleteAdministeredItems |
The Delete Administered Items service.
|
Service.ExcelExport |
The Export Excel service.
|
Service.ExcelImport |
The Import Excel service.
|
Service.MetadataCreation |
Manually create an Administered Item.
|
Service.PDFExport |
The Export PDF service.
|
Service.RefreshAdministeredItems |
The Refresh Administered Items service.
|
Service.ValidateAdministeredItems |
The Validate Administered Items service.
|
ServiceResult |
Represents the result of a service execution.
|
Class | Description |
---|---|
ExcelExportSpec |
Defines execution options for the Export Excel service.
|
ExcelExportSpecFactory |
The factory for creating the
ExcelExportSpec corresponding to two available modes: Light and Full. |
ExcelImportSpec |
Defines parameters to run the Import Excel service.
|
IGovServiceFactory |
The factory for all {addon.label}'s service instances.
|
IGovServiceSpec | Deprecated
From 1.7.0, please use the new API
ServiceSpec instead. |
MetadataCreationSpec |
Defines the settings to manually create an Administered Item.
|
PDFExportSpec |
Defines execution options for the Export PDF service.
|
ServiceSpec |
Defines the settings for a service execution.
|
Provides APIs to execute the {addon.label} services.
Initializes the ServiceSpec
to create a service spec.
ServiceSpec serviceSpec = new ServiceSpec( IGovConstants.IGOV_HOMEKEY, PrimaryKey.parseString("1"), session);
Uses IGovServiceFactory
to get the service and calls the execute
method.
To run the Create Administered Items service:
AdministeredItemResult result = (AdministeredItemResult) IGovServiceFactory.getService(ServiceType.CREATE_ADMINISTERED_ITEMS).execute(serviceSpec);
To run the Refresh Administered Items service:
AdministeredItemResult result = (AdministeredItemResult) IGovServiceFactory.getService(ServiceType.REFRESH_ADMINISTERED_ITEM).execute(serviceSpec);
To run the Validate Administered Items service:
AdministeredItemResult result = (AdministeredItemResult) IGovServiceFactory.getService(ServiceType.VALIDATE_ADMINISTERED_ITEM).execute(serviceSpec);
To run the Delete Administered Items service:
AdministeredItemResult result = (AdministeredItemResult) IGovServiceFactory.getService(ServiceType.DELETE_ADMINISTERED_ITEM).execute(serviceSpec);
The execution result can be retrieved in AdministeredItemResult
.
To run the Export Excel service:
Either calls the ExcelExportSpecFactory.getFullSpec
method to create a spec to export the Administered Items in the Full
mode.
List<Locale> languages = new ArrayList<Locale>(); languages.add(Locale.US); List<PrimaryKey> contexts = new ArrayList<PrimaryKey>(); contexts.add(IGovConstants.DEFAULT_CONTEXT); ExcelExportSpec exportSpec = ExcelExportSpecFactory.getFullSpec( IGovConstants.IGOV_HOMEKEY, PrimaryKey.parseString("1"), languages, contexts, Locale.US, IGovConstants.DEFAULT_CONTEXT, ExportOutput.EXCEL_2007, session);
Or calls the ExcelExportSpecFactory.getLightSpec
to export in the Light
mode.
ExcelExportSpec exportSpec = ExcelExportSpecFactory.getLightSpec( IGovConstants.IGOV_HOMEKEY, PrimaryKey.parseString("1"), Locale.US, IGovConstants.DEFAULT_CONTEXT, true, ExportOutput.EXCEL_2007, session);
Uses IGovServiceFactory
to get the service and calls the execute
method.
ExportResult result = (ExportResult) IGovServiceFactory.getService(ServiceType.EXPORT_EXCEL).execute(exportSpec);
The execution result can be retrieved in ExportResult
.
To run the Export PDF service:
Initializes the PDFExportSpec
to create a spec to export the Administered Items to PDF.
PDFExportSpec exportSpec = new PDFExportSpec( IGovConstants.IGOV_HOMEKEY, PrimaryKey.parseString("1"), Locale.US, PrimaryKey.parseString("MyContext"), //The default context cannot be chosen here. true, session);
Uses IGovServiceFactory
to get the service and calls the execute
method.
ExportResult result = (ExportResult) IGovServiceFactory.getService(ServiceType.EXPORT_PDF).execute(exportSpec);
The execution result can be retrieved in ExportResult
.
To run the Import Excel service:
Initializes the ExcelImportSpec
to create an import spec.
ExcelImportSpec importSpec = new ExcelImportSpec( IGovConstants.IGOV_HOMEKEY, PrimaryKey.parseString("1"), new File("c:\import_data.xls"), false, session);
Uses IGovServiceFactory
to get the service and calls the execute
method.
ExcelImportResult result = (ExcelImportResult) IGovServiceFactory.getService(ServiceType.IMPORT_EXCEL).execute(importSpec);
The execution result can be retrieved in ExcelImportResult
.
To get the list of rows that were not imported:
List<ExcelImportDataError> errors = result.getErrors(); for(ExcelImportDataError error : errors) { //This row is an Item (In the Item sheet) if (error.getErrorType().isItem()) { } //This row is a Rule (In the Rule sheet) if (error.getErrorType().isRule()) { } //The row number in the Excel file error.getRowNumber(); }
To manually create an Administered Item:
Initializes the MetadataCreationSpec
to create a creation spec. Several parameters are needed to create different metadata types.
MetadataCreationSpec creationSpec = new MetadataCreationSpec( IGovConstants.IGOV_HOMEKEY, PrimaryKey.parseString("1"), session, ISOType.PROPERTY, EBXType.FIELD, "Available", new ArrayList<ContextDefinitionBean>(), false);
Uses IGovServiceFactory
to get metadata creation service and calls the execute
method.
MetadataCreationResult result = (MetadataCreationResult) IGovServiceFactory.getService(ServiceType.METADATA_CREATION) .execute(creationSpec);
The execution result can be retrieved in MetadataCreationResult
. If the execution is successful, the created PrimaryKey
will be returned.