示例#1
0
  /**
   * This method builds the custom data collections used on the form
   *
   * @param customAttributeGroups
   */
  @SuppressWarnings("unchecked")
  public void buildCustomDataCollectionsOnNewDocument(
      SortedMap<String, List> customAttributeGroups) {
    for (Map.Entry<String, CustomAttributeDocument> customAttributeDocumentEntry :
        getCustomAttributeDocuments().entrySet()) {
      String temp = customAttributeDocumentEntry.getValue().getCustomAttribute().getValue();
      String groupName =
          customAttributeDocumentEntry.getValue().getCustomAttribute().getGroupName();

      T newCustomData = getNewCustomData();
      newCustomData.setCustomAttribute(
          customAttributeDocumentEntry.getValue().getCustomAttribute());
      newCustomData.setCustomAttributeId(
          customAttributeDocumentEntry.getValue().getCustomAttributeId().longValue());
      newCustomData.setValue(
          customAttributeDocumentEntry.getValue().getCustomAttribute().getDefaultValue());
      getCustomDataList().add(newCustomData);

      if (StringUtils.isEmpty(groupName)) {
        groupName = "No Group";
      }

      List<CustomAttributeDocument> customAttributeDocumentList =
          customAttributeGroups.get(groupName);
      if (customAttributeDocumentList == null) {
        customAttributeDocumentList = new ArrayList<CustomAttributeDocument>();
        customAttributeGroups.put(groupName, customAttributeDocumentList);
      }
      customAttributeDocumentList.add(
          getCustomAttributeDocuments()
              .get(customAttributeDocumentEntry.getValue().getCustomAttributeId().toString()));
      Collections.sort(customAttributeDocumentList, new LabelComparator());
    }
  }
 public T get(T settingsContainer) {
   for (String key : settingsContainer.getKeys()) {
     Setting setting = getByKey(key);
     if (setting != null) {
       settingsContainer.setValue(key, setting.getValue());
     }
   }
   return settingsContainer;
 }
 /**
  * Get the list of referenced values.
  *
  * @param valueDescriptor The value descriptor containing a list value.
  * @param <T> The type of the value descriptor.
  * @return The list of referenced values.
  */
 private <T extends ValueDescriptor<List<ValueDescriptor>>> List<ValueDescriptor> getListValue(
     T valueDescriptor) {
   List<ValueDescriptor> values = valueDescriptor.getValue();
   if (values == null) {
     values = new LinkedList<>();
     valueDescriptor.setValue(values);
   }
   return values;
 }
示例#4
0
文件: Dtos.java 项目: kyocum/seqware
 /**
  * fromDto.
  *
  * @param attributeDto a {@link net.sourceforge.seqware.webservice.dto.AttributeDto} object.
  * @param clazz a {@link java.lang.Class} object.
  * @param <T> a T object.
  * @return a T object.
  * @throws java.lang.InstantiationException if any.
  * @throws java.lang.IllegalAccessException if any.
  */
 public static <T extends Attribute> T fromDto(AttributeDto attributeDto, Class<T> clazz)
     throws InstantiationException, IllegalAccessException {
   T attribute = clazz.newInstance();
   attribute.setTag(attributeDto.getName());
   attribute.setValue(attributeDto.getValue());
   if (attributeDto.getUnit() != null) {
     attribute.setUnit(attributeDto.getUnit());
   }
   return attribute;
 }
示例#5
0
 private <T extends IGeneratorParameter<S>, S, U extends S> void setParam(Class<T> key, U val) {
   T param = null;
   try {
     param = key.newInstance();
     param.setValue(val);
     params.put(key, param);
   } catch (InstantiationException | IllegalAccessException e) {
     LoggingToolFactory.createLoggingTool(getClass())
         .error("Could not copy rendering parameter: " + key);
   }
 }
 public static <T extends Enum<? extends WritableIntValueHolder> & WritableIntValueHolder>
     void populateValues(Properties properties, T[] values, boolean sendops) {
   ExternalCodeTableGetter exc = new ExternalCodeTableGetter(properties);
   for (T code : values) {
     int val = exc.getValue(code.name(), values, -2);
     if (val != -2) {
       code.setValue(val);
     } else if (sendops) {
       System.out.println(
           "Check your Send Packet Opcodes - Something is wrong \r\n "
               + code.toString()
               + " is missing.");
     }
   }
 }
 @Override
 public <T extends BaseInfo> void setData(T data) {
   data.setValue("REFERENCE_NZzjg_YJFW", StorageModule.getInstance().getZzjgInfo().ID);
   data.setValue("REFERENCE_NZzjg_YJFW_desc", StorageModule.getInstance().getZzjgInfo().JGMC);
   super.setData(data);
 }