GlideDynamicAttribute - Global
A API GlideDynamicAttribute fornece acesso a metadados de atributo dinâmico.
Esta API fornece métodos que permitem obter valores de esquema dinâmico definidos na tabela Atributo dinâmico [dynamic_attribute]. Os atributos dinâmicos têm um tipo de dados definido e um sys_id. Para obter mais detalhes sobre atributos dinâmicos, consulte Esquema dinâmico. Os mesmos métodos também estão disponíveis para atributos dinâmicos transitórios na API GlideTransientDynamicAttribute - Global.
Para usar esta API para criar atributos dinâmicos, você deve ter a função dynamic_schema_writer. Para ler dados dinâmicos usando esta API, você deve ter a função dynamic_schema_reader.
GlideDynamicAttribute – getGroupName()
Obtém o valor da propriedade de nome do grupo de um objeto de atributo dinâmico.
| Nome | Tipo | Descrição |
|---|---|---|
| Nenhum |
| Tipo | Descrição |
|---|---|
| Cadeia de caracteres | Valor da propriedade do nome do grupo do atributo dinâmico. Consulte também Create a dynamic attribute group. |
No exemplo a seguir, o valor do nome do grupo de objetos de atributo dinâmico é exibido como um.
var das = new GlideDynamicAttributeStore();
das.setDynamicAttributeValue('a->b', 5); // transient (adding here)
das.setDynamicAttributeValue('a->c', 10); // defined in dynamic_attribute table
var attributes = das.getDynamicAttributes();
gs.info(attributes);
for (var i = 0; i < attributes.length; i++) {
var attr = attributes[i];
gs.info("");
gs.info("[" + i + "].getPath() = " + attr.getPath());
gs.info("[" + i + "].getName() = " + attr.getName());
gs.info("[" + i + "].getGroupName() = " + attr.getGroupName());
gs.info("[" + i + "].getSysId() = " + attr.getSysId());
gs.info("[" + i + "].isTransient() = " + attr.isTransient());
gs.info("[" + i + "].getType() = " + attr.getType());
}
Saída:
*** Script: a->c,a->b
*** Script:
*** Script: [0].getPath() = a->c
*** Script: [0].getName() = c
*** Script: [0].getGroupName() = a
*** Script: [0].getSysId() = 8bc411a94fc01210b8ddc0e552ce0b3c
*** Script: [0].isTransient() = false
*** Script: [0].getType() = integer
*** Script:
*** Script: [1].getPath() = a->b
*** Script: [1].getName() = b
*** Script: [1].getGroupName() = a
*** Script: [1].getSysId() = undefined
*** Script: [1].isTransient() = true
*** Script: [1].getType() = string
GlideDynamicAttribute – getName()
Obtém o valor da propriedade de nome de um objeto de atributo dinâmico.
| Nome | Tipo | Descrição |
|---|---|---|
| Nenhum |
| Tipo | Descrição |
|---|---|
| Cadeia de caracteres | Valor da propriedade de nome do atributo dinâmico. |
No exemplo a seguir, o valor do nome do objeto de atributo dinâmico é exibido como c.
var das = new GlideDynamicAttributeStore();
das.setDynamicAttributeValue('a->b', 5); // transient (adding here)
das.setDynamicAttributeValue('a->c', 10); // defined in dynamic_attribute table
var attributes = das.getDynamicAttributes();
gs.info(attributes);
for (var i = 0; i < attributes.length; i++) {
var attr = attributes[i];
gs.info("");
gs.info("[" + i + "].getPath() = " + attr.getPath());
gs.info("[" + i + "].getName() = " + attr.getName());
gs.info("[" + i + "].getGroupName() = " + attr.getGroupName());
gs.info("[" + i + "].getSysId() = " + attr.getSysId());
gs.info("[" + i + "].isTransient() = " + attr.isTransient());
gs.info("[" + i + "].getType() = " + attr.getType());
}
Saída:
*** Script: a->c,a->b
*** Script:
*** Script: [0].getPath() = a->c
*** Script: [0].getName() = c
*** Script: [0].getGroupName() = a
*** Script: [0].getSysId() = 8bc411a94fc01210b8ddc0e552ce0b3c
*** Script: [0].isTransient() = false
*** Script: [0].getType() = integer
*** Script:
*** Script: [1].getPath() = a->b
*** Script: [1].getName() = b
*** Script: [1].getGroupName() = a
*** Script: [1].getSysId() = undefined
*** Script: [1].isTransient() = true
*** Script: [1].getType() = string
GlideDynamicAttribute – getPath()
Obtém o valor da propriedade de caminho de um objeto de atributo dinâmico.
| Nome | Tipo | Descrição |
|---|---|---|
| Nenhum |
| Tipo | Descrição |
|---|---|
| Cadeia de caracteres | Valor do caminho do atributo dinâmico. |
No exemplo a seguir, o valor do caminho do objeto de atributo dinâmico é exibido como a->c.
var das = new GlideDynamicAttributeStore();
das.setDynamicAttributeValue('a->b', 5); // transient (adding here)
das.setDynamicAttributeValue('a->c', 10); // defined in dynamic_attribute table
var attributes = das.getDynamicAttributes();
gs.info(attributes);
for (var i = 0; i < attributes.length; i++) {
var attr = attributes[i];
gs.info("");
gs.info("[" + i + "].getPath() = " + attr.getPath());
gs.info("[" + i + "].getName() = " + attr.getName());
gs.info("[" + i + "].getGroupName() = " + attr.getGroupName());
gs.info("[" + i + "].getSysId() = " + attr.getSysId());
gs.info("[" + i + "].isTransient() = " + attr.isTransient());
gs.info("[" + i + "].getType() = " + attr.getType());
}
Saída:
*** Script: a->c,a->b
*** Script:
*** Script: [0].getPath() = a->c
*** Script: [0].getName() = c
*** Script: [0].getGroupName() = a
*** Script: [0].getSysId() = 8bc411a94fc01210b8ddc0e552ce0b3c
*** Script: [0].isTransient() = false
*** Script: [0].getType() = integer
*** Script:
*** Script: [1].getPath() = a->b
*** Script: [1].getName() = b
*** Script: [1].getGroupName() = a
*** Script: [1].getSysId() = undefined
*** Script: [1].isTransient() = true
*** Script: [1].getType() = string
GlideDynamicAttribute – getSysId()
Obtém o sys_id de um objeto de atributo dinâmico.
| Nome | Tipo | Descrição |
|---|---|---|
| Nenhum |
| Tipo | Descrição |
|---|---|
| Cadeia de caracteres | Valor do sys_id do atributo dinâmico. |
No exemplo a seguir, o valor do sys_id do objeto de atributo dinâmico é exibido como 8bc411a94fc01210b8ddc0e552ce0b3c.
var das = new GlideDynamicAttributeStore();
das.setDynamicAttributeValue('a->b', 5); // transient (adding here)
das.setDynamicAttributeValue('a->c', 10); // defined in dynamic_attribute table
var attributes = das.getDynamicAttributes();
gs.info(attributes);
for (var i = 0; i < attributes.length; i++) {
var attr = attributes[i];
gs.info("");
gs.info("[" + i + "].getPath() = " + attr.getPath());
gs.info("[" + i + "].getName() = " + attr.getName());
gs.info("[" + i + "].getGroupName() = " + attr.getGroupName());
gs.info("[" + i + "].getSysId() = " + attr.getSysId());
gs.info("[" + i + "].isTransient() = " + attr.isTransient());
gs.info("[" + i + "].getType() = " + attr.getType());
}
Saída:
*** Script: a->c,a->b
*** Script:
*** Script: [0].getPath() = a->c
*** Script: [0].getName() = c
*** Script: [0].getGroupName() = a
*** Script: [0].getSysId() = 8bc411a94fc01210b8ddc0e552ce0b3c
*** Script: [0].isTransient() = false
*** Script: [0].getType() = integer
*** Script:
*** Script: [1].getPath() = a->b
*** Script: [1].getName() = b
*** Script: [1].getGroupName() = a
*** Script: [1].getSysId() = undefined
*** Script: [1].isTransient() = true
*** Script: [1].getType() = string
GlideDynamicAttribute – getType()
Obtém o valor da propriedade de tipo de um objeto de atributo dinâmico.
| Nome | Tipo | Descrição |
|---|---|---|
| Nenhum |
| Tipo | Descrição |
|---|---|
| Cadeia de caracteres | Valor do tipo de dados do atributo dinâmico. |
No exemplo a seguir, o valor do tipo de objeto de atributo dinâmico é exibido como inteiro.
var das = new GlideDynamicAttributeStore();
das.setDynamicAttributeValue('a->b', 5); // transient (adding here)
das.setDynamicAttributeValue('a->c', 10); // defined in dynamic_attribute table
var attributes = das.getDynamicAttributes();
gs.info(attributes);
for (var i = 0; i < attributes.length; i++) {
var attr = attributes[i];
gs.info("");
gs.info("[" + i + "].getPath() = " + attr.getPath());
gs.info("[" + i + "].getName() = " + attr.getName());
gs.info("[" + i + "].getGroupName() = " + attr.getGroupName());
gs.info("[" + i + "].getSysId() = " + attr.getSysId());
gs.info("[" + i + "].isTransient() = " + attr.isTransient());
gs.info("[" + i + "].getType() = " + attr.getType());
}
Saída:
*** Script: a->c,a->b
*** Script:
*** Script: [0].getPath() = a->c
*** Script: [0].getName() = c
*** Script: [0].getGroupName() = a
*** Script: [0].getSysId() = 8bc411a94fc01210b8ddc0e552ce0b3c
*** Script: [0].isTransient() = false
*** Script: [0].getType() = integer
*** Script:
*** Script: [1].getPath() = a->b
*** Script: [1].getName() = b
*** Script: [1].getGroupName() = a
*** Script: [1].getSysId() = undefined
*** Script: [1].isTransient() = true
*** Script: [1].getType() = string
GlideDynamicAttribute – isTransient()
Retorna se um objeto é um atributo dinâmico transitório.
| Nome | Tipo | Descrição |
|---|---|---|
| Nenhum |
| Tipo | Descrição |
|---|---|
| Booliano | Sinalizador que indica se um atributo dinâmico é transitório. Valores válidos:
Nota: A tabela Atributo dinâmico [dynamic_attribute] pode ser acessada navegando até , selecionando um grupo e selecionando a guia Atributos dinâmicos. |
No exemplo a seguir, o método isTransient() retorna falso para o objeto não transitório.
var das = new GlideDynamicAttributeStore();
das.setDynamicAttributeValue('a->b', 5); // transient (adding here)
das.setDynamicAttributeValue('a->c', 10); // defined in dynamic_attribute table
var attributes = das.getDynamicAttributes();
gs.info(attributes);
for (var i = 0; i < attributes.length; i++) {
var attr = attributes[i];
gs.info("");
gs.info("[" + i + "].getPath() = " + attr.getPath());
gs.info("[" + i + "].getName() = " + attr.getName());
gs.info("[" + i + "].getGroupName() = " + attr.getGroupName());
gs.info("[" + i + "].getSysId() = " + attr.getSysId());
gs.info("[" + i + "].isTransient() = " + attr.isTransient());
gs.info("[" + i + "].getType() = " + attr.getType());
}
Saída:
*** Script: a->c,a->b
*** Script:
*** Script: [0].getPath() = a->c
*** Script: [0].getName() = c
*** Script: [0].getGroupName() = a
*** Script: [0].getSysId() = 8bc411a94fc01210b8ddc0e552ce0b3c
*** Script: [0].isTransient() = false
*** Script: [0].getType() = integer
*** Script:
*** Script: [1].getPath() = a->b
*** Script: [1].getName() = b
*** Script: [1].getGroupName() = a
*** Script: [1].getSysId() = undefined
*** Script: [1].isTransient() = true
*** Script: [1].getType() = string