private <T extends ReviewRequestBase> T fillReviewRequestBase(
      T reviewRequest, JSONObject jsonReviewRequest) throws JSONException {

    reviewRequest.setId(jsonReviewRequest.getInt("id"));
    reviewRequest.setSummary(jsonReviewRequest.getString("summary"));
    reviewRequest.setTestingDone(jsonReviewRequest.getString("testing_done"));
    reviewRequest.setDescription(jsonReviewRequest.getString("description"));
    reviewRequest.setPublic(jsonReviewRequest.getBoolean("public"));
    reviewRequest.setBranch(jsonReviewRequest.getString("branch"));

    // bugs
    reviewRequest.setBugsClosed(readStringArray(jsonReviewRequest, "bugs_closed"));

    // target people
    JSONArray jsonTargetPeople = jsonReviewRequest.getJSONArray("target_people");
    List<String> targetPeople = new ArrayList<String>();
    for (int j = 0; j < jsonTargetPeople.length(); j++)
      targetPeople.add(jsonTargetPeople.getJSONObject(j).getString("title"));
    reviewRequest.setTargetPeople(targetPeople);

    // target groups
    JSONArray jsonTargetGroups = jsonReviewRequest.getJSONArray("target_groups");
    List<String> targetGroups = new ArrayList<String>();
    for (int j = 0; j < jsonTargetGroups.length(); j++)
      targetGroups.add(jsonTargetGroups.getJSONObject(j).getString("title"));
    reviewRequest.setTargetGroups(targetGroups);

    return reviewRequest;
  }
 protected final void map(final ResultSet rs, final T entity) throws SQLException {
   entity.setOsId(rs.getInt("os"));
   entity.setDescription(rs.getString("description"));
   entity.setComment(rs.getString("free_text_comment"));
   entity.setCreationDate(DbFacadeUtils.fromDate(rs.getTimestamp("creation_date")));
   entity.setNumOfSockets(rs.getInt("num_of_sockets"));
   entity.setCpuPerSocket(rs.getInt("cpu_per_socket"));
   entity.setTimeZone(rs.getString("time_zone"));
   entity.setVmType(VmType.forValue(rs.getInt("vm_type")));
   entity.setUsbPolicy(UsbPolicy.forValue(rs.getInt("usb_policy")));
   entity.setFailBack(rs.getBoolean("fail_back"));
   entity.setDefaultBootSequence(BootSequence.forValue(rs.getInt("default_boot_sequence")));
   entity.setNiceLevel(rs.getInt("nice_level"));
   entity.setCpuShares(rs.getInt("cpu_shares"));
   entity.setPriority(rs.getInt("priority"));
   entity.setAutoStartup(rs.getBoolean("auto_startup"));
   entity.setStateless(rs.getBoolean("is_stateless"));
   entity.setDbGeneration(rs.getLong("db_generation"));
   entity.setIsoPath(rs.getString("iso_path"));
   entity.setOrigin(OriginType.forValue(rs.getInt("origin")));
   entity.setKernelUrl(rs.getString("kernel_url"));
   entity.setKernelParams(rs.getString("kernel_params"));
   entity.setInitrdUrl(rs.getString("initrd_url"));
   entity.setSmartcardEnabled(rs.getBoolean("is_smartcard_enabled"));
   entity.setDeleteProtected(rs.getBoolean("is_delete_protected"));
   entity.setSsoMethod(SsoMethod.fromString(rs.getString("sso_method")));
   entity.setTunnelMigration((Boolean) rs.getObject("tunnel_migration"));
   entity.setVncKeyboardLayout(rs.getString("vnc_keyboard_layout"));
   entity.setRunAndPause(rs.getBoolean("is_run_and_pause"));
   entity.setCreatedByUserId(Guid.createGuidFromString(rs.getString("created_by_user_id")));
   entity.setMigrationDowntime((Integer) rs.getObject("migration_downtime"));
   entity.setSerialNumberPolicy(
       SerialNumberPolicy.forValue((Integer) rs.getObject("serial_number_policy")));
   entity.setCustomSerialNumber(rs.getString("custom_serial_number"));
 }
  /**
   * Creates a Reference Type Object and stores it into the cache. Typically called during Class
   * Type Initialization to define Constants. This is protected. Utilize AbstractLookupType to
   * create Constants.
   *
   * @param code
   * @param description
   * @param lookupTypeClass
   */
  protected static <T extends LookupType> T createConstant(
      String code, String description, Class<T> lookupTypeClass) {
    try {
      T retVal = lookupTypeClass.newInstance();
      retVal.setCode(code);
      retVal.setDescription(description);

      addToCache(retVal);
      return retVal;
    } catch (Exception e) {
      throw new RuntimeException(e);
    }
  }
Example #4
0
  @Override
  protected void readAttributes(XMLStreamReader reader, T object) {
    object.setName(reader.getAttributeValue(null, NodeValidate.s_nameField));
    object.setDescription(reader.getAttributeValue(null, NodeValidate.s_descName));
    object.setLocation(reader.getAttributeValue(null, NodeValidate.s_locationField));
    object.setLocationExpressionLanguage(
        reader.getAttributeValue(null, NodeValidate.s_locExprLangName));
    object.setFieldName(reader.getAttributeValue(null, NodeValidate.s_fieldName));

    Integer value =
        XMIReaderUtil.convertToInteger(reader.getAttributeValue(null, NodeValidate.s_minName));
    if (value != null) {
      object.setMinOccurs(value);
    }

    value = XMIReaderUtil.convertToInteger(reader.getAttributeValue(null, NodeValidate.s_maxName));
    if (value != null) {
      object.setMaxOccurs(value);
    }
  }
  protected <T extends AbstractArchiveTask> T addTaskDistBundle(
      final Project project,
      String taskName,
      Class<T> clazz,
      final Configuration bundleConfiguration,
      WorkspaceExtension workspaceExtension) {

    T task = GradleUtil.addTask(project, taskName, clazz);

    configureTaskCopyBundle(task, bundleConfiguration);

    task.from(
        project.file("configs/common"),
        project.file("configs/" + workspaceExtension.getEnvironment()));

    task.setBaseName(project.getName());
    task.setDescription("Assembles the bundle and zips it up.");
    task.setDestinationDir(project.getBuildDir());
    task.setIncludeEmptyDirs(false);

    return task;
  }
Example #6
0
 public void setDescription(String description) {
   String old = getDescription();
   config.setDescription(description);
   notifyPropertyChanged(DESCRIPTION_PROPERTY, old, description);
 }