2016-04-22 11 views
0

XpagesでJavaのODAに移行します。私は自分のPCオブジェクトのクラスを持っています。何かが日付で動作していません。私は日付が含まれている私のXPageを保存しようとすると、引数の型の不一致Xpages:OpenNTF ODAの日付の問題

:私はエラーに

java.lang.IllegalArgumentExceptionがを取得しています。実際に日付を入力して保存しようとするとエラーが表示されます。この行にエラーが発生します。

public DateTime getCheckInDate() { 
    return checkInDate; 
} 

ここに関連するJavaコードがあります。次のように

package com.scoular.model; 

import java.io.Serializable; 
import java.util.HashMap; 

import javax.faces.context.FacesContext; 

import org.openntf.domino.*; 
import org.openntf.domino.utils.Factory; 
import org.openntf.domino.xsp.XspOpenLogUtil; 
import org.openntf.domino.impl.DateTime; 

import com.scoular.cache.PCConfig; 

public class PC implements Serializable { 

    private static final long serialVersionUID = 1L; 

    // Common Fields 
    private String unid; 
    private Boolean newNote; 
    private String unique; 

    // Custom Fields 
    private String status; 
    private String serialNumber; 
    private String model; 
    private String officeLoc; 
    private DateTime checkInDate; 

    public DateTime getCheckInDate() { 
     return checkInDate; 
    } 

    public void setCheckInDate(DateTime checkInDate) { 
     this.checkInDate = checkInDate; 
    } 

フォームに関連するコードは次のとおりです。

<xc:cc_CommonFormField id="cc_CheckInDate" 
         placeholder="Check In Date" label="Check In Date"> 
         <xp:this.facets> 
          <xp:inputText xp:key="field" 
           id="checkInDate" value="#{PCModel.checkInDate}"> 
           <xp:this.converter> 
            <xp:convertDateTime type="both"> 
            </xp:convertDateTime> 
           </xp:this.converter> 
           <xp:dateTimeHelper></xp:dateTimeHelper> 
          </xp:inputText> 
         </xp:this.facets> 
        </xc:cc_CommonFormField> 

答えて

3

それ日作る、JavaクラスでのDateTimeを使用しないでください。 ReplaceItemValueの(「日付フィールド」、dateProperty)によって、文書にあなたの店日付を保存

文書から日時を取得するには、 doc.getItemValue(「日付フィールド」、Date.class)

+1

で ODAに関する素晴らしい点の1つは、保存する前にDateTimeを作成する必要がないということです。これは、DateをreplaceItemValueに渡すだけで、自動的に変換されます。 –

+0

もうベクトルを使用しません;-) –