Package com.sogou.qadev.service.cynthia.bean

Examples of com.sogou.qadev.service.cynthia.bean.CommonField


    if(fieldSet == null)
      return;

    for(Field field : fieldSet)
    {
      CommonField commonField = new CommonField();
      commonField.setId(field.getId().toString());
      commonField.setName(field.getName());
      commonField.setType(field.getType().toString().split("\\_")[1]);
      if(field.getDataType() != null)
        commonField.setDataType(field.getDataType().toString().split("\\_")[1]);

      fieldMap.put(commonField.getId(), commonField);

      if(field.getType().equals(Field.Type.t_selection))
      {
        if(field.getOptions() != null && field.getOptions().size() > 0)
        {
          fieldOptionMap.put(commonField.getId(), new TreeSet<CommonOption>());

          for(Option option : field.getOptions())
          {
            CommonOption commonOption = new CommonOption();
            commonOption.setId(option.getId().toString());
            commonOption.setName(option.getName());

            fieldOptionMap.get(commonField.getId()).add(commonOption);
          }
        }
      }
      else if(field.getType().equals(Field.Type.t_reference))
      {
        Data[] referenceArray = das.queryTemplateFieldReferences(templateId, field.getId());
        if(referenceArray != null && referenceArray.length > 0)
        {
          fieldOptionMap.put(commonField.getId(), new TreeSet<CommonOption>());

          for(Data reference : referenceArray)
          {
            CommonOption commonOption = new CommonOption();
            commonOption.setId(reference.getId().toString());
            commonOption.setName(reference.getTitle());

            fieldOptionMap.get(commonField.getId()).add(commonOption);
          }
        }
      }
      else if(field.getType().equals(Field.Type.t_attachment))
      {
        Attachment[] attachmentArray = das.queryTemplateFieldAttachments(templateId, field.getId());
        if(attachmentArray != null && attachmentArray.length > 0)
        {
          fieldOptionMap.put(commonField.getId(), new TreeSet<CommonOption>());

          for(Attachment attachment : attachmentArray)
          {
            CommonOption commonOption = new CommonOption();
            commonOption.setId(attachment.getId().toString());
            commonOption.setName(attachment.getName());

            fieldOptionMap.get(commonField.getId()).add(commonOption);
          }
        }
      }
    }
  }
View Full Code Here

TOP

Related Classes of com.sogou.qadev.service.cynthia.bean.CommonField

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.