Introduce New Business Object with Unique Constraints

You can easily introduce entirely a new business object in the system by sending a post request as below. This will create a physical table in the database and it will also create its metadata as per its structure.

Following are the conditions which should be met to introduce a new business object along with its unique constraints.

  1. As you are going to introduce a new business object in the system therefore the main request will be of type BUSINESS OBJECT.

  2. In the children section of the business object you must have data to define BUS OBJ ATTR UNIQ CONSTRAINTS.

  3. Either you want to add a simple unique constraint or a composite unique constraint the request will be same. In case of composite unique constraint the unique constraint name will be same for more than once instances of the unique constraint business object.

  4. You can give a unique constraint name but if you do not provide then system will generate the unique constraint name with the pattern of UIX__ and all instances involved in unique constraint will be considered as simple unique constraint .

  5. In unique constraint definition, if the constraint name is provided, the length of constraint name can not be greater than 200, and it should not be the same as constrait name already exists.

  6. In unique constraint definition the bo name will be the current bo name which is going to be defined and it is mandatory.

  7. In unique constraint definition the bo attr name will be the current business object attribute which you want it to be involved in the unique constraint.

  8. In unique constraint definition, primary key should not provided in any of the unique constraint.

1. Request URL

/{PDM Server domain}/metadata/write/introduceNewBusinessObjects

Method: POST

2. Request headers

Name Value

Content-Type

application/json

3. Response Type

Name Value

responseType

blob

4. Request body

Introduce New business object with unique constraint

{
    "BUSINESS OBJECT": {
        "language": "en",
        "readBack": true,
        "timezone": "GMT+08:00",
        "showSQLStats": true,
        "data": [
            {
                "BO_NAME": "{{boName}}",
                "BO_DISPLAY_NAME": "{{boName}}",
                "ENTITY": "{{boName}}",
                "BO_DESC": "{{boName}}",
                "KEY_SEQ_NAME": "SEQ_{{boName}}",
                "IS_MASTER_DATA": true,
                "IS_OPERATIONAL_TABLE": false,
                "IS_RESULT_TABLE": false,
                "IS_METADATA_TABLE": false,
                "IS_REFERENCE_TABLE": false,
                "IS_ACTIVE": true,
                "children": {
                    "BUSINESS OBJECT ATTR": {
                        "language": "en",
                        "readBack": false,
                        "timezone": "GMT+08:00",
                        "data": [
                            {
                                "BO_ATTR_NAME": "{{boName}}_ID",
                                "ATTRIBUTE": "{{boName}}_ID",
                                "ATTRIBUTE_DISPLAYNAME": "{{boName}} ID",
                                "ATTRIBUTE_DATATYPE": "integer",
                                "SEQUENCE_NUM": 1,
                                "IS_MANDATORY": true,
                                "IS_PARTITIONED": false,
                                "IS_UPLOAD_NEEDED": false,
                                "IS_HIDDEN": true,
                                "IS_REFERENCE_IND": false,
                                "IS_UNIQUE": true,
                                "IS_PRIMARY_KEY": true,
                                "IS_ACTIVE": true,
                                "IS_SORTABLE": true,
                                "IS_INTERNAL": true
                            },
                            {
                                "BO_ATTR_NAME": "{{boName}}_NAME",
                                "ATTRIBUTE": "{{boName}}_NAME",
                                "ATTRIBUTE_DISPLAYNAME": "{{boName}} Name",
                                "ATTRIBUTE_DATATYPE": "Character Varying(50)",
                                "SEQUENCE_NUM": 2,
                                "IS_MANDATORY": true,
                                "IS_PARTITIONED": false,
                                "IS_UPLOAD_NEEDED": true,
                                "IS_HIDDEN": false,
                                "IS_REFERENCE_IND": false,
                                "IS_UNIQUE": true,
                                "IS_PRIMARY_KEY": false,
                                "IS_ACTIVE": true,
                                "IS_SORTABLE": true,
                                "IS_INTERNAL": false,
                                "RELATED_BO_ATTR_NAME": "{{boName}}_ID"
                            },
                            {
                                "BO_ATTR_NAME": "WELL_TEST_ID",
                                "ATTRIBUTE": "WELL_TEST_ID",
                                "ATTRIBUTE_DISPLAYNAME": "WELL TEST ID",
                                "ATTRIBUTE_DATATYPE": "integer",
                                "SEQUENCE_NUM": 3,
                                "IS_MANDATORY": true,
                                "IS_PARTITIONED": false,
                                "IS_UPLOAD_NEEDED": false,
                                "IS_HIDDEN": true,
                                "IS_REFERENCE_IND": false,
                                "IS_UNIQUE": false,
                                "IS_PRIMARY_KEY": false,
                                "IS_ACTIVE": true,
                                "IS_SORTABLE": true,
                                "IS_INTERNAL": true,
                                "ATTRIBUTE_DESC": "Foreign key well test id"
                            },
                            {
                                "BO_ATTR_NAME": "UWI",
                                "BO_DISPLAY_NAME": "Well Test",
                                "ATTRIBUTE": "UWI",
                                "ATTRIBUTE_DISPLAYNAME": "UWI",
                                "ATTRIBUTE_DATATYPE": "character varying(50)",
                                "CONTROL_TYPE": "autoComplete",
                                "SEQUENCE_NUM": 4,
                                "IS_MANDATORY": true,
                                "IS_PARTITIONED": false,
                                "IS_UPLOAD_NEEDED": true,
                                "IS_HIDDEN": false,
                                "IS_REFERENCE_IND": false,
                                "IS_UNIQUE": true,
                                "IS_PRIMARY_KEY": false,
                                "IS_ACTIVE": true,
                                "ATTRIBUTE_FONTSIZE": 0,
                                "IS_SORTABLE": true,
                                "ATTRIBUTE_DESC": "UNIQUE WELL IDENTIFIER: A unique name, code or number designated.",
                                "IS_INTERNAL": false,
                                "IS_READ_ONLY": false,
                                "IS_CUSTOM_ATTRIBUTE": false,
                                "HAS_UNIT": false,
                                "IS_UNIT_ATTRIBUTE": false,
                                "IS_NOT_NULL": true
                            },
                            {
                                "BO_ATTR_NAME": "START_TIME",
                                "BO_DISPLAY_NAME": "Well Test",
                                "ATTRIBUTE": "START_TIME",
                                "ATTRIBUTE_DISPLAYNAME": "Start Time",
                                "ATTRIBUTE_DATATYPE": "datetime",
                                "CONTROL_TYPE": "calenderWithDateTime",
                                "SEQUENCE_NUM": 5,
                                "IS_MANDATORY": true,
                                "IS_PARTITIONED": false,
                                "IS_UPLOAD_NEEDED": true,
                                "IS_HIDDEN": false,
                                "IS_REFERENCE_IND": false,
                                "IS_UNIQUE": true,
                                "IS_PRIMARY_KEY": false,
                                "IS_ACTIVE": true,
                                "ATTRIBUTE_FONTSIZE": 0,
                                "IS_SORTABLE": true,
                                "ATTRIBUTE_DESC": "START TIME: The start time of the stable flow of  this well test.",
                                "IS_INTERNAL": false,
                                "IS_READ_ONLY": false,
                                "IS_CUSTOM_ATTRIBUTE": false,
                                "HAS_UNIT": false,
                                "IS_UNIT_ATTRIBUTE": false,
                                "IS_NOT_NULL": true
                            }
                        ]
                    },
                    "BUS OBJ ATTR UNIQ CONSTRAINTS": {
                        "language": "en",
                        "readBack": true,
                        "timezone": "GMT+08:00",
                        "showSQLStats": true,
                        "data": [
                            {
                                "CONSTRAINT_NAME": "UNIQUE_{{boName}}_UWI_START_TIME",
                                "BO_NAME": "{{boName}}",
                                "BO_ATTR_NAME": "UWI"
                            },
                            {
                                "CONSTRAINT_NAME": "UNIQUE_{{boName}}_UWI_START_TIME",
                                "BO_NAME": "{{boName}}",
                                "BO_ATTR_NAME": "START_TIME"
                            },
                            {
                                "CONSTRAINT_NAME": "UNIQUE_{{boName}}_NAME",
                                "BO_NAME": "{{boName}}",
                                "BO_ATTR_NAME": "{{boName}}_NAME"
                            }
                        ]
                    }
                }
            }
        ]
    }
}
Try it myself

5. Responses

When response.status = 200, It will response a `application/octet-stream' excel file.

Otherwise, it will response json file, Please see Responses