Ejemplo n.º 1
0
  private void getAutoFieldsServiceTag(Element element, Set<String> fieldNames)
      throws GenericServiceException {
    String serviceName = UtilFormatOut.checkNull(element.getAttribute("service-name"));
    String defaultFieldType = UtilFormatOut.checkNull(element.getAttribute("default-field-type"));
    if (UtilValidate.isNotEmpty(serviceName) && (!("hidden".equals(defaultFieldType)))) {
      ModelService modelService = dispatchContext.getModelService(serviceName);
      List<ModelParam> modelParams = modelService.getInModelParamList();
      Iterator<ModelParam> modelParamIter = modelParams.iterator();
      while (modelParamIter.hasNext()) {
        ModelParam modelParam = modelParamIter.next();
        // skip auto params that the service engine populates...
        if ("userLogin".equals(modelParam.name)
            || "locale".equals(modelParam.name)
            || "timeZone".equals(modelParam.name)) {
          continue;
        }
        if (modelParam.formDisplay) {
          if (UtilValidate.isNotEmpty(modelParam.entityName)
              && UtilValidate.isNotEmpty(modelParam.fieldName)) {
            ModelEntity modelEntity;
            modelEntity = delegator.getModelEntity(modelParam.entityName);

            if (modelEntity != null) {
              ModelField modelField = modelEntity.getField(modelParam.fieldName);

              if (modelField != null) {
                fieldNames.add(modelField.getName());
              }
            }
          }
        }
      }
    }
  }
Ejemplo n.º 2
0
 private void getAutoFieldsEntityTag(Element element, Set<String> fieldNames) {
   String entityName = UtilFormatOut.checkNull(element.getAttribute("entity-name"));
   String defaultFieldType = UtilFormatOut.checkNull(element.getAttribute("default-field-type"));
   if (UtilValidate.isNotEmpty(entityName)
       && UtilValidate.isNotEmpty(defaultFieldType)
       && (!("hidden".equals(defaultFieldType)))) {
     ModelEntity entity = delegator.getModelEntity(entityName);
     for (Iterator<ModelField> f = entity.getFieldsIterator(); f.hasNext(); ) {
       ModelField field = f.next();
       fieldNames.add(field.getName());
     }
   }
 }