use of life.genny.qwanda.attribute.EntityAttribute in project rulesservice by genny-project.
the class QRules method getBaseEntityValueAsLocalDate.
public LocalDate getBaseEntityValueAsLocalDate(final String baseEntityCode, final String attributeCode) {
BaseEntity be = getBaseEntityByCode(baseEntityCode);
Optional<EntityAttribute> ea = be.findEntityAttribute(attributeCode);
if (ea.isPresent()) {
return ea.get().getValueDate();
} else {
return null;
}
}
use of life.genny.qwanda.attribute.EntityAttribute in project rulesservice by genny-project.
the class QRules method getMapOfAllAttributesValuesForBaseEntity.
/*
* Gets all the attribute and their value for the given basenentity code
*/
public Map<String, String> getMapOfAllAttributesValuesForBaseEntity(String beCode) {
BaseEntity be = getBaseEntityByCode(beCode);
println("The load is ::" + be);
Set<EntityAttribute> eaSet = be.getBaseEntityAttributes();
println("The set of attributes are :: " + eaSet);
Map<String, String> attributeValueMap = new HashMap<String, String>();
for (EntityAttribute ea : eaSet) {
String attributeCode = ea.getAttributeCode();
println("The attribute code is :: " + attributeCode);
String value = ea.getAsLoopString();
attributeValueMap.put(attributeCode, value);
}
return attributeValueMap;
}
use of life.genny.qwanda.attribute.EntityAttribute in project rulesservice by genny-project.
the class QRules method getBaseEntityValueAsLocalTime.
public LocalTime getBaseEntityValueAsLocalTime(final String baseEntityCode, final String attributeCode) {
BaseEntity be = getBaseEntityByCode(baseEntityCode);
Optional<EntityAttribute> ea = be.findEntityAttribute(attributeCode);
if (ea.isPresent()) {
return ea.get().getValueTime();
} else {
return null;
}
}
use of life.genny.qwanda.attribute.EntityAttribute in project rulesservice by genny-project.
the class QRules method addAttributes.
public void addAttributes(BaseEntity be) {
for (EntityAttribute ea : be.getBaseEntityAttributes()) {
if (ea != null) {
Attribute attribute = RulesUtils.attributeMap.get(ea.getAttributeCode());
if (attribute != null) {
ea.setAttribute(attribute);
} else {
RulesUtils.loadAllAttributesIntoCache(getToken());
attribute = RulesUtils.attributeMap.get(ea.getAttributeCode());
if (attribute != null) {
ea.setAttribute(attribute);
} else {
log.error("Cannot get Attribute - " + ea.getAttributeCode());
Attribute dummy = new AttributeText(ea.getAttributeCode(), ea.getAttributeCode());
ea.setAttribute(dummy);
}
}
}
}
}
Aggregations