Beispiel #1
0
 private static JavaScriptObject toJSOArray(DataClass[] array) {
   final JavaScriptObject arrayJSO = JavaScriptObject.createArray();
   for (int i = 0; i < array.length; i++) {
     JSOHelper.setArrayValue(arrayJSO, i, array[i].getJsObj());
   }
   return arrayJSO;
 }
Beispiel #2
0
 private static ListGridRecord[] convertToListGridRecordArray(JavaScriptObject jsObject) {
   if (jsObject == null) {
     return new ListGridRecord[0];
   }
   JavaScriptObject[] jsArray = JSOHelper.toArray(jsObject);
   ListGridRecord[] records = new ListGridRecord[jsArray.length];
   for (int i = 0; i < jsArray.length; i++) {
     JavaScriptObject jsArrayItem = jsArray[i];
     ListGridRecord record = (ListGridRecord) RefDataClass.getRef(jsArrayItem);
     if (record == null) {
       record = new ListGridRecord(jsArrayItem);
     }
     records[i] = record;
   }
   return records;
 }
 protected void buildMVEL(
     Criteria criteria,
     StringBuffer sb,
     String entityKey,
     DataSource dataSource,
     OperatorId groupOperator)
     throws IncompatibleMVELTranslationException {
   OperatorId operator = EnumUtil.getEnum(OperatorId.values(), criteria.getAttribute("operator"));
   JavaScriptObject listJS = criteria.getAttributeAsJavaScriptObject("criteria");
   if (sb.length() != 0 && sb.charAt(sb.length() - 1) != '(' && groupOperator != null) {
     switch (groupOperator) {
       default:
         sb.append("&&");
         break;
       case OR:
         sb.append("||");
     }
   }
   if (!JSOHelper.isArray(listJS)) {
     buildExpression(criteria, sb, entityKey, operator, dataSource);
   } else {
     boolean includeTopLevelParenthesis = false;
     if (sb.length() != 0 || operator.getValue().equals(OperatorId.NOT.getValue())) {
       includeTopLevelParenthesis = true;
     }
     if (operator.getValue().equals(OperatorId.NOT.getValue())) {
       sb.append("!");
     }
     if (includeTopLevelParenthesis) sb.append("(");
     Criteria[] myCriterias = AdvancedCriteria.convertToCriteriaArray(listJS);
     for (Criteria myCriteria : myCriterias) {
       buildMVEL(myCriteria, sb, entityKey, dataSource, operator);
     }
     if (includeTopLevelParenthesis) sb.append(")");
   }
 }
Beispiel #4
0
 public final void setAddresses(ContactAddress... contactAddresses) {
   setAddresses(JSOHelper.convertToJsArray(contactAddresses));
 }
Beispiel #5
0
 public final void setEmailAddresses(ContactField... emailAddresses) {
   setEmailAddresses(JSOHelper.convertToJsArray(emailAddresses));
 }
Beispiel #6
0
 public final void setPhoneNumbers(ContactField... phoneNumbers) {
   setPhoneNumbers(JSOHelper.convertToJsArray(phoneNumbers));
 }