Beispiel #1
0
 public FindByAnd(Element element, SimpleMethod simpleMethod) throws MiniLangException {
   super(element, simpleMethod);
   if (MiniLangValidate.validationOn()) {
     MiniLangValidate.attributeNames(
         simpleMethod,
         element,
         "entity-name",
         "use-cache",
         "fields-to-select-list",
         "use-iterator",
         "list",
         "map",
         "order-by-list",
         "delegator-name");
     MiniLangValidate.requiredAttributes(simpleMethod, element, "entity-name", "list", "map");
     MiniLangValidate.expressionAttributes(
         simpleMethod,
         element,
         "list",
         "map",
         "fields-to-select-list",
         "order-by-list",
         "delegator-name");
     MiniLangValidate.noChildElements(simpleMethod, element);
   }
   entityNameFse = FlexibleStringExpander.getInstance(element.getAttribute("entity-name"));
   listFma = FlexibleMapAccessor.getInstance(element.getAttribute("list"));
   mapFma = FlexibleMapAccessor.getInstance(element.getAttribute("map"));
   orderByListFma = FlexibleMapAccessor.getInstance(element.getAttribute("order-by-list"));
   fieldsToSelectListFma =
       FlexibleMapAccessor.getInstance(element.getAttribute("fields-to-select-list"));
   useCacheFse = FlexibleStringExpander.getInstance(element.getAttribute("use-cache"));
   useIteratorFse = FlexibleStringExpander.getInstance(element.getAttribute("use-iterator"));
 }
 public TransactionRollback(Element element, SimpleMethod simpleMethod) throws MiniLangException {
   super(element, simpleMethod);
   if (MiniLangValidate.validationOn()) {
     MiniLangValidate.attributeNames(simpleMethod, element, "began-transaction-name");
     MiniLangValidate.expressionAttributes(simpleMethod, element, "began-transaction-name");
     MiniLangValidate.noChildElements(simpleMethod, element);
   }
   beganTransactionFma =
       FlexibleMapAccessor.getInstance(
           MiniLangValidate.checkAttribute(
               element.getAttribute("began-transaction-name"), "beganTransaction"));
 }
Beispiel #3
0
 public EntityCount(Element element, SimpleMethod simpleMethod) throws MiniLangException {
   super(element, simpleMethod);
   if (MiniLangValidate.validationOn()) {
     MiniLangValidate.attributeNames(
         simpleMethod, element, "entity-name", "count-field", "delegator-name");
     MiniLangValidate.requiredAttributes(simpleMethod, element, "entity-name", "count-field");
     MiniLangValidate.expressionAttributes(simpleMethod, element, "count-field", "delegator-name");
     MiniLangValidate.childElements(
         simpleMethod,
         element,
         "condition-expr",
         "condition-list",
         "condition-object",
         "having-condition-list");
     MiniLangValidate.requireAnyChildElement(
         simpleMethod, element, "condition-expr", "condition-list", "condition-object");
   }
   this.entityNameFse = FlexibleStringExpander.getInstance(element.getAttribute("entity-name"));
   this.countFma = FlexibleMapAccessor.getInstance(element.getAttribute("count-field"));
   int conditionElementCount = 0;
   Element conditionExprElement = UtilXml.firstChildElement(element, "condition-expr");
   conditionElementCount =
       conditionExprElement == null ? conditionElementCount : conditionElementCount++;
   Element conditionListElement = UtilXml.firstChildElement(element, "condition-list");
   conditionElementCount =
       conditionListElement == null ? conditionElementCount : conditionElementCount++;
   Element conditionObjectElement = UtilXml.firstChildElement(element, "condition-object");
   conditionElementCount =
       conditionObjectElement == null ? conditionElementCount : conditionElementCount++;
   if (conditionElementCount > 1) {
     MiniLangValidate.handleError(
         "Element must include only one condition child element",
         simpleMethod,
         conditionObjectElement);
   }
   if (conditionExprElement != null) {
     this.whereCondition = new ConditionExpr(conditionExprElement);
   } else if (conditionListElement != null) {
     this.whereCondition = new ConditionList(conditionListElement);
   } else if (conditionObjectElement != null) {
     this.whereCondition = new ConditionObject(conditionObjectElement);
   } else {
     this.whereCondition = null;
   }
   Element havingConditionListElement =
       UtilXml.firstChildElement(element, "having-condition-list");
   if (havingConditionListElement != null) {
     this.havingCondition = new ConditionList(havingConditionListElement);
   } else {
     this.havingCondition = null;
   }
 }
Beispiel #4
0
 private ResultToField(Element element, SimpleMethod simpleMethod) throws ValidationException {
   if (MiniLangValidate.validationOn()) {
     MiniLangValidate.attributeNames(simpleMethod, element, "result-name", "field");
     MiniLangValidate.requiredAttributes(simpleMethod, element, "result-name");
     MiniLangValidate.expressionAttributes(simpleMethod, element, "result-name", "field");
     MiniLangValidate.noChildElements(simpleMethod, element);
   }
   this.resultNameFma = FlexibleMapAccessor.getInstance(element.getAttribute("result-name"));
   String fieldAttribute = element.getAttribute("field");
   if (fieldAttribute.length() == 0) {
     this.fieldFma = this.resultNameFma;
   } else {
     this.fieldFma = FlexibleMapAccessor.getInstance(fieldAttribute);
   }
 }
Beispiel #5
0
 public SessionToField(Element element, SimpleMethod simpleMethod) throws MiniLangException {
   super(element, simpleMethod);
   if (MiniLangValidate.validationOn()) {
     MiniLangValidate.attributeNames(simpleMethod, element, "field", "session-name", "default");
     MiniLangValidate.requiredAttributes(simpleMethod, element, "field");
     MiniLangValidate.expressionAttributes(simpleMethod, element, "field");
     MiniLangValidate.noChildElements(simpleMethod, element);
   }
   this.fieldFma = FlexibleMapAccessor.getInstance(element.getAttribute("field"));
   String attributeName = element.getAttribute("session-name");
   if (!attributeName.isEmpty()) {
     this.attributeNameFse = FlexibleStringExpander.getInstance(attributeName);
   } else {
     this.attributeNameFse = FlexibleStringExpander.getInstance(this.fieldFma.toString());
   }
   this.defaultFse = FlexibleStringExpander.getInstance(element.getAttribute("default"));
 }
Beispiel #6
0
 public EntityData(Element element, SimpleMethod simpleMethod) throws MiniLangException {
   super(element, simpleMethod);
   if (MiniLangValidate.validationOn()) {
     MiniLangValidate.attributeNames(
         simpleMethod,
         element,
         "location",
         "timeout",
         "delegator-name",
         "error-list-name",
         "mode");
     MiniLangValidate.requiredAttributes(simpleMethod, element, "location");
     MiniLangValidate.expressionAttributes(simpleMethod, element, "delegator-name");
     MiniLangValidate.constantAttributes(simpleMethod, element, "timeout", "mode");
     MiniLangValidate.noChildElements(simpleMethod, element);
   }
   locationFse = FlexibleStringExpander.getInstance(element.getAttribute("location"));
   mode = MiniLangValidate.checkAttribute(element.getAttribute("mode"), "load");
   String timeoutAttribute = element.getAttribute("timeout");
   if (!"load".equals(mode) && !timeoutAttribute.isEmpty()) {
     MiniLangValidate.handleError(
         "timeout attribute is valid only when mode=\"load\".", simpleMethod, element);
   }
   int timeout = -1;
   if (!timeoutAttribute.isEmpty()) {
     try {
       timeout = Integer.parseInt(timeoutAttribute);
     } catch (NumberFormatException e) {
       MiniLangValidate.handleError(
           "Exception thrown while parsing timeout attribute: " + e.getMessage(),
           simpleMethod,
           element);
     }
   }
   this.timeout = timeout;
   errorListFma =
       FlexibleMapAccessor.getInstance(
           MiniLangValidate.checkAttribute(element.getAttribute("error-list-name"), "error_list"));
 }