Пример #1
0
  private double calculateDescriptionProgress() {
    Text result = sqlSession.getMapper(TextMapper.class).read("Product" + propertyId + "Public");

    String description = result.getNotes();

    /* set 1 when description length is greater than 299*/
    double progress = description.length() < 300 ? description.length() * 100.0 / 300.0 : 100.0;

    return progress * descriptionWeightage;
  }
Пример #2
0
  private double calculateOptionsProgress() {
    Text text = new Text();
    text.setId(propertyId + "_property");
    text.setName("property");

    Text result = sqlSession.getMapper(TextMapper.class).read("Product" + propertyId + "Contents");

    String options = result.getNotes();

    double progress = options.length() < 30 ? options.length() * 100.0 / 30.0 : 100.0;

    return progress * optionsWeightage;
  }
Пример #3
0
 /* (non-Javadoc)
  * @see net.cbtltd.client.field.AbstractField#setValue(java.lang.Object)
  */
 public void setValue(String value) {
   if (value == null) {
     value = Model.BLANK;
   } else if (secure) {
     value = Model.decrypt(value);
   }
   if (hasFormat(Text.Type.Text)) {
     field.setText(Text.stripHTML(value));
   } // CJM
   else {
     field.setText(value);
   }
   super.setChanged();
 }
Пример #4
0
 /* (non-Javadoc)
  * @see net.cbtltd.client.field.AbstractField#getValue()
  */
 public String getValue() {
   String value = field.getText();
   if (hasFormat(Text.Type.Text)) {
     value = Text.stripHTML(value);
   } // CJM
   else {
     value = field.getText();
   }
   if (value.length() > maxlength) {
     value = value.substring(0, maxlength);
   }
   if (secure) {
     return Model.encrypt(value);
   } else {
     return value;
   }
 }