コード例 #1
0
 String extractPhonenumber(final String number) {
   final String result =
       NumberHelper.extractPhonenumber(
           number,
           Configuration.getInstance()
               .getStringValue(ConfigurationParam.DEFAULT_COUNTRY_PHONE_PREFIX));
   if (StringUtils.isNotEmpty(result) == true
       && StringUtils.isNotEmpty(ConfigXml.getInstance().getTelephoneSystemNumber()) == true
       && result.startsWith(ConfigXml.getInstance().getTelephoneSystemNumber()) == true) {
     return result.substring(ConfigXml.getInstance().getTelephoneSystemNumber().length());
   }
   return result;
 }
コード例 #2
0
 public static final boolean isJIRAConfigured() {
   return ConfigXml.getInstance().isJIRAConfigured();
 }
コード例 #3
0
 /**
  * @return Default page of ProjectForge. Currently {@link WicketApplication#DEFAULT_PAGE} is the
  *     default page (e. g. to redirect after cancel if no other return page is specified).
  */
 public static Class<? extends WebPage> getDefaultPage() {
   final WebConfig webConfig = ConfigXml.getInstance().getWebConfig();
   return webConfig != null ? webConfig.getDefaultPage() : WicketApplication.DEFAULT_PAGE;
 }
コード例 #4
0
 private void callNow() {
   if (StringUtils.isBlank(ConfigXml.getInstance().getTelephoneSystemUrl()) == true) {
     log.error("Telephone system url not configured. Phone calls not supported.");
     return;
   }
   log.info(
       "User initiates direct call from phone with id '"
           + form.getMyCurrentPhoneId()
           + "' to destination numer: "
           + StringHelper.hideStringEnding(form.getPhoneNumber(), 'x', 3));
   result = null;
   final StringBuffer buf = new StringBuffer();
   buf.append(form.getPhoneNumber()).append(SEPARATOR);
   final AddressDO address = form.getAddress();
   if (address != null
       && StringHelper.isIn(
               form.getPhoneNumber(),
               extractPhonenumber(address.getBusinessPhone()),
               extractPhonenumber(address.getMobilePhone()),
               extractPhonenumber(address.getPrivatePhone()),
               extractPhonenumber(address.getPrivateMobilePhone()))
           == true) {
     buf.append(address.getFirstName()).append(" ").append(address.getName());
     if (form.getPhoneNumber().equals(extractPhonenumber(address.getMobilePhone())) == true) {
       buf.append(", ").append(getString("address.phoneType.mobile"));
     } else if (form.getPhoneNumber().equals(extractPhonenumber(address.getPrivatePhone()))
         == true) {
       buf.append(", ").append(getString("address.phoneType.private"));
     }
     buf.append(" #").append(address.getId());
   } else {
     buf.append("???");
   }
   final HttpClient client = new HttpClient();
   String url = ConfigXml.getInstance().getTelephoneSystemUrl();
   url = StringUtils.replaceOnce(url, "#source", form.getMyCurrentPhoneId());
   url = StringUtils.replaceOnce(url, "#target", form.getPhoneNumber());
   final String urlProtected = StringHelper.hideStringEnding(url, 'x', 3);
   final GetMethod method = new GetMethod(url);
   String errorKey = null;
   try {
     form.lastSuccessfulPhoneCall = new Date();
     client.executeMethod(method);
     final String resultStatus = method.getResponseBodyAsString();
     if ("0".equals(resultStatus) == true) {
       result =
           DateTimeFormatter.instance().getFormattedDateTime(new Date())
               + ": "
               + getString("address.phoneCall.result.successful");
       form.getRecentSearchTermsQueue().append(buf.toString());
     } else if ("2".equals(resultStatus) == true) {
       errorKey = "address.phoneCall.result.wrongSourceNumber";
     } else if ("3".equals(resultStatus) == true) {
       errorKey = "address.phoneCall.result.wrongDestinationNumber";
     } else {
       errorKey = "address.phoneCall.result.callingError";
     }
   } catch (final HttpException ex) {
     result = "Call failed. Please contact administrator.";
     log.fatal(result + ": " + urlProtected);
     throw new RuntimeException(ex);
   } catch (final IOException ex) {
     result = "Call failed. Please contact administrator.";
     log.fatal(result + ": " + urlProtected);
     throw new RuntimeException(ex);
   }
   if (errorKey != null) {
     form.addError(errorKey);
   }
 }
コード例 #5
0
 @Override
 protected void init() {
   super.init();
   // GRID 50% - BLOCK
   gridBuilder.newSplitPanel(GridSize.COL50);
   {
     // Number
     final FieldsetPanel fs = gridBuilder.newFieldset(getString("legalAffaires.contract.number"));
     fs.add(new DivTextPanel(fs.newChildId(), "C-"));
     numberField =
         new MinMaxNumberField<Integer>(
             InputPanel.WICKET_ID, new PropertyModel<Integer>(data, "number"), 0, 99999999);
     numberField.setMaxLength(8);
     WicketUtils.setSize(numberField, 6);
     fs.add(numberField);
     if (NumberHelper.greaterZero(getData().getNumber()) == false) {
       fs.addHelpIcon(getString("fibu.tooltip.nummerWirdAutomatischVergeben"));
     }
   }
   {
     // Date
     final FieldsetPanel fs = gridBuilder.newFieldset(getString("date"));
     datePanel =
         new DatePanel(
             fs.newChildId(),
             new PropertyModel<Date>(data, "date"),
             DatePanelSettings.get().withTargetType(java.sql.Date.class));
     fs.add(datePanel);
   }
   {
     // Title
     final FieldsetPanel fs = gridBuilder.newFieldset(getString("title"));
     fs.add(createAutocompleteTextField("title"))
         .getField()
         .setRequired(true)
         .add(WicketUtils.setFocus());
   }
   {
     // Contract type
     final FieldsetPanel fs = gridBuilder.newFieldset(getString("legalAffaires.contract.type"));
     final List<ContractType> contractTypes = ConfigXml.getInstance().getContractTypes();
     final LabelValueChoiceRenderer<ContractType> typeChoiceRenderer =
         new LabelValueChoiceRenderer<ContractType>(contractTypes);
     final DropDownChoice<ContractType> typeChoice =
         new DropDownChoice<ContractType>(
             fs.getDropDownChoiceId(),
             new PropertyModel<ContractType>(data, "type"),
             typeChoiceRenderer.getValues(),
             typeChoiceRenderer);
     typeChoice.setNullValid(false);
     fs.add(typeChoice);
   }
   {
     // Status
     final FieldsetPanel fs = gridBuilder.newFieldset(getString("status"));
     // DropDownChoice for convenient selection of time periods.
     final LabelValueChoiceRenderer<String> statusChoiceRenderer =
         new LabelValueChoiceRenderer<String>();
     for (final ContractStatus status : ContractStatus.values()) {
       statusChoiceRenderer.addValue(status.name(), getString(status.getI18nKey()));
     }
     final DropDownChoice<String> statusChoice =
         new DropDownChoice<String>(
             fs.getDropDownChoiceId(),
             new PropertyModel<String>(data, "status"),
             statusChoiceRenderer.getValues(),
             statusChoiceRenderer);
     statusChoice.setNullValid(false);
     fs.add(statusChoice);
   }
   gridBuilder.newSplitPanel(GridSize.COL50);
   {
     // Reference
     final FieldsetPanel fs = gridBuilder.newFieldset(getString("fibu.common.reference"));
     fs.add(
         new MaxLengthTextField(
             InputPanel.WICKET_ID, new PropertyModel<String>(data, "reference")));
   }
   {
     // Resubmission date
     final FieldsetPanel fs = gridBuilder.newFieldset(getString("resubmissionOnDate"));
     resubmissionDatePanel =
         new DatePanel(
             fs.newChildId(),
             new PropertyModel<Date>(data, "resubmissionOnDate"),
             DatePanelSettings.get().withTargetType(java.sql.Date.class));
     fs.add(resubmissionDatePanel);
   }
   {
     // Due date
     final FieldsetPanel fs = gridBuilder.newFieldset(getString("dueDate"));
     dueDatePanel =
         new DatePanel(
             fs.newChildId(),
             new PropertyModel<Date>(data, "dueDate"),
             DatePanelSettings.get().withTargetType(java.sql.Date.class));
     fs.add(dueDatePanel);
   }
   {
     // Signing date
     final FieldsetPanel fs =
         gridBuilder.newFieldset(getString("legalAffaires.contract.signing"), getString("date"));
     signingDatePanel =
         new DatePanel(
             fs.newChildId(),
             new PropertyModel<Date>(data, "signingDate"),
             DatePanelSettings.get().withTargetType(java.sql.Date.class));
     fs.add(signingDatePanel);
   }
   {
     // Validity
     final FieldsetPanel fs =
         gridBuilder.newFieldset(getString("legalAffaires.contract.validity"));
     validFromDatePanel =
         new DatePanel(
             fs.newChildId(),
             new PropertyModel<Date>(data, "validFrom"),
             DatePanelSettings.get().withTargetType(java.sql.Date.class));
     fs.add(validFromDatePanel);
     fs.add(new DivTextPanel(fs.newChildId(), "-"));
     validUntilDatePanel =
         new DatePanel(
             fs.newChildId(),
             new PropertyModel<Date>(data, "validUntil"),
             DatePanelSettings.get().withTargetType(java.sql.Date.class));
     fs.add(validUntilDatePanel);
   }
   gridBuilder.newSplitPanel(GridSize.COL50);
   {
     // CocontractorA
     final FieldsetPanel fs =
         gridBuilder.newFieldset(getString("legalAffaires.contract.coContractorA"));
     fs.add(createAutocompleteTextField("coContractorA"));
   }
   {
     // CopersonA
     final FieldsetPanel fs =
         gridBuilder.newFieldset(getString("legalAffaires.contract.contractPersonA"));
     fs.add(createAutocompleteTextField("contractPersonA"));
   }
   {
     // SignerA
     final FieldsetPanel fs = gridBuilder.newFieldset(getString("legalAffaires.contract.signerA"));
     fs.add(createAutocompleteTextField("signerA"));
   }
   /* GRID8 */
   gridBuilder.newSplitPanel(GridSize.COL50);
   {
     // CocontractorB
     final FieldsetPanel fs =
         gridBuilder.newFieldset(getString("legalAffaires.contract.coContractorB"));
     fs.add(createAutocompleteTextField("coContractorB"));
   }
   {
     // CopersonB
     final FieldsetPanel fs =
         gridBuilder.newFieldset(getString("legalAffaires.contract.contractPersonB"));
     fs.add(createAutocompleteTextField("contractPersonB"));
   }
   {
     // SignerB
     final FieldsetPanel fs = gridBuilder.newFieldset(getString("legalAffaires.contract.signerB"));
     fs.add(createAutocompleteTextField("signerB"));
   }
   /* GRID16 */
   gridBuilder.newGridPanel();
   {
     // Text with JIRA support
     final FieldsetPanel fs = gridBuilder.newFieldset(getString("text"));
     final IModel<String> model = new PropertyModel<String>(data, "text");
     fs.add(new MaxLengthTextArea(TextAreaPanel.WICKET_ID, model));
     fs.addJIRAField(model);
   }
   {
     // Filing
     final FieldsetPanel fs = gridBuilder.newFieldset(getString("filing"));
     fs.add(
         new MaxLengthTextField(InputPanel.WICKET_ID, new PropertyModel<String>(data, "filing")));
   }
   addCloneButton();
 }