本文整理汇总了Java中lotus.domino.Document.getItemValue方法的典型用法代码示例。如果您正苦于以下问题:Java Document.getItemValue方法的具体用法?Java Document.getItemValue怎么用?Java Document.getItemValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类lotus.domino.Document
的用法示例。
在下文中一共展示了Document.getItemValue方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: evaluate
import lotus.domino.Document; //导入方法依赖的package包/类
public Object evaluate(RestDocumentService service, Document document) throws ServiceException {
// TODO: How can we cache the item name so we do not reevaluate it all the time?
String itemName = getItemName();
try {
if(StringUtil.isNotEmpty(itemName) && document.hasItem(itemName)) {
return document.getItemValue(itemName);
}
} catch (NotesException e) {
throw new ServiceException(e);
}
String var = service.getParameters().getVar();
if(StringUtil.isNotEmpty(var)) {
// TODO: Do that on a per item basis only...
Object old = service.getHttpRequest().getAttribute(var);
try {
service.getHttpRequest().setAttribute(var,document);
return getValue();
} finally {
service.getHttpRequest().setAttribute(var,old);
}
} else {
return getValue();
}
}
示例2: profileRemoveDelegate
import lotus.domino.Document; //导入方法依赖的package包/类
/**
* Removes a delegate from the calendar profile.
*
* @param profile
* @param delegateName
* @throws NotesException
*/
private void profileRemoveDelegate(Document profile, String delegateName) throws NotesException {
Session session = profile.getParentDatabase().getParent();
// Do for each delegate access item
for ( int i = 0; i < s_items.length; i++ ) {
// Read the item value
Vector values = profile.getItemValue(s_items[i]);
// Remove this name from the vector
for ( int j = 0; j < values.size(); j++ ) {
String strName = (String)values.get(j);
Name name = session.createName(strName);
if ( delegateName.equals(name.getAbbreviated())) {
values.remove(j);
profile.replaceItemValue(s_items[i], values);
break;
}
}
}
}
示例3: getViewName
import lotus.domino.Document; //导入方法依赖的package包/类
private String getViewName(Document viewDoc) throws NotesException {
String name = "";
String[] aliases = null;
Vector<?> names = viewDoc.getItemValue(FIELD_TITLE);
if ( names != null && names.size() > 0 ){
String title = (String)names.get( 0 );
//Compute the aliases
ArrayList<String> aliasesList = new ArrayList<String>();
StringTokenizer st = new StringTokenizer( title, "|");
while ( st.hasMoreTokens() ){
if ( name == null ){
name = st.nextToken().trim();
}else{
aliasesList.add( st.nextToken().trim() );
}
}
for ( int i = 1; i < names.size(); i++ ){
aliasesList.add( (String)names.get( i ) );
}
aliases = aliasesList.toArray( new String[0] );
}else if ( viewDoc.hasItem( FIELD_TITLE ) ) {
name=""; //Empty name
}
if (name.length() == 0)
if (aliases != null)
name = aliases[0];
return name;
}
示例4: parseReceivedFromNote
import lotus.domino.Document; //导入方法依赖的package包/类
/**
* Given a note received from another user, parse the from display name and internet address.
*
* @param doc
* Email note to parse for sender data
* @return
* @throws NotesException
*/
private List<RecentContact> parseReceivedFromNote(final Document doc) throws NotesException
{
// Currently only getting from address - may get items like others that were on the email
// in the future.
final List<RecentContact> recentContacts = new ArrayList<RecentContact>(1);
final RecentContact sender = new RecentContact();
recentContacts.add(sender);
final Vector dateVec = doc.getItemValue("DeliveredDate"); //$NON-NLS-1$
if (doc.hasItem("INetFrom")) //$NON-NLS-1$
{
sender.InternetAddress = doc.getItemValueString("INetFrom"); //$NON-NLS-1$
if (sender.InternetAddress.contains("<"))
{
processComboInet(sender, sender.InternetAddress);
}
else
{
sender.DisplayName = doc.getItemValueString("From"); //$NON-NLS-1$
sender.DisplayName = sender.DisplayName.replaceAll("CN=|OU=|O=|@.*", ""); //$NON-NLS-1$
}
}
else
{
processComboInet(sender, doc.getItemValueString("From")); //$NON-NLS-1$
}
sender.lastContacted = getDateFromVector(dateVec);
return recentContacts;
}
示例5: loadVectors
import lotus.domino.Document; //导入方法依赖的package包/类
private Vector[] loadVectors(Document profile) throws NotesException {
Vector[] vectors = new Vector[s_items.length];
for ( int i = 0; i < s_items.length; i++ ) {
String item = s_items[i];
vectors[i] = profile.getItemValue(item);
}
return vectors;
}
示例6: bind
import lotus.domino.Document; //导入方法依赖的package包/类
public void bind(Document doc, Object bean){
ReflectionUtils reflect = new ReflectionUtils();
PropertyDescriptor[] props = reflect.getProperties(bean);
try {
for(PropertyDescriptor prop : props){
Vector values =doc.getItemValue(prop.getName());
Object value = values.elementAt(0);
if(value instanceof DateTime){
DateTime dt = (DateTime) value;
value = dt.toJavaDate();
if(values.size() > 1){
value = this.toDateList(values);
}
}else if(value instanceof String && ("true".equals(value) || "false".equals(value))){
if("true".equals(value)){
value = true;
}else{
value = false;
}
}
else{
//check to see if its a multi-value field
if(values.size() > 1){
value = this.toList(values);
}
}
//write to the bean.
if("".equals(value) || null == value){
reflect.invokeSetter(prop.getWriteMethod(), bean, null);
}else{
reflect.invokeSetter(prop.getWriteMethod(), bean, value);
}
}
} catch (Exception e) {
logger.log(Level.SEVERE, "Uncaught exception", e);
}
}
示例7: parseSentToFromNote
import lotus.domino.Document; //导入方法依赖的package包/类
/**
* Given a note that was sent to other users - parse display names and internet addresses. List of PersonRecords will
* be returned for data parsed from TO, CC, and BCC fields.
*
* @param doc
* Email note to parse for recipient data
* @return
* @throws NotesException
*/
private List<RecentContact> parseSentToFromNote(final Document doc) throws NotesException
{
final List<RecentContact> recentContacts = new LinkedList<RecentContact>();
final Vector dateVec = doc.getItemValue("PostedDate"); //$NON-NLS-1$
final Date emailDate = getDateFromVector(dateVec);
final String[][] itemPairsToRead = { { "InetSendTo", "SendTo" }, //$NON-NLS-1$ //$NON-NLS-2$
{ "InetCopyTo", "CopyTo" }, //$NON-NLS-1$ //$NON-NLS-2$
{ "InetBlindCopyTo", "BlindCopyTo" } }; //$NON-NLS-1$ //$NON-NLS-2$
for (int i = 0; i < itemPairsToRead.length; ++i)
{
final Vector inetVector = doc.getItemValue(itemPairsToRead[i][0]);
final Vector nameVector = doc.getItemValue(itemPairsToRead[i][1]);
if (nameVector == null || nameVector.size() == 0)
{
continue;
}
final boolean hasInet = (inetVector != null && inetVector.size() > 0);
for (int addrIndex = 0; addrIndex < nameVector.size(); ++addrIndex)
{
final RecentContact person = new RecentContact();
if (hasInet && !(person.InternetAddress = (String) inetVector.get(addrIndex)).contains("<"))
{
person.DisplayName = (String) nameVector.get(addrIndex);
person.DisplayName = person.DisplayName.replaceAll("CN=|OU=|O=|@.*", ""); //$NON-NLS-1$
}
else
{
// This is not a notes recipient then - address in SendTo
processComboInet(person, (String) nameVector.get(addrIndex));
}
person.lastContacted = emailDate;
recentContacts.add(person);
}
}
return recentContacts;
}
示例8: profileAddDelegate
import lotus.domino.Document; //导入方法依赖的package包/类
/**
* Adds a delegate to the calendar profile.
*
* @param profile
* @param delegate
* @throws NotesException
*/
private void profileAddDelegate(Document profile, Delegate delegate) throws NotesException {
Session session = profile.getParentDatabase().getParent();
Name name = session.createName(delegate.getName());
DelegateAccess da = delegate.getAccess();
String appendItems[] = null;
if ( da.getWhat() == DelegateAccess.What.CALENDAR ) {
if ( da.isCreate() || da.isEdit() || da.isDelete() ) {
appendItems = new String[] {READ_CALENDAR_ITEM, WRITE_CALENDAR_ITEM};
}
else {
appendItems = new String[] {READ_CALENDAR_ITEM};
}
}
else if ( da.getWhat() == DelegateAccess.What.MAIL ) {
if ( da.isEdit() ) {
if ( da.isDelete() ) {
appendItems = new String[] {WRITE_CALENDAR_ITEM, EDIT_MAIL_ITEM, DELETE_MAIL_ITEM};
}
else {
appendItems = new String[] {WRITE_CALENDAR_ITEM, EDIT_MAIL_ITEM};
}
}
else if ( da.isCreate() ) {
if ( da.isDelete() ) {
appendItems = new String[] {WRITE_CALENDAR_ITEM, WRITE_MAIL_ITEM, DELETE_MAIL_ITEM};
}
else {
appendItems = new String[] {WRITE_CALENDAR_ITEM, WRITE_MAIL_ITEM};
}
}
else {
appendItems = new String[] {READ_MAIL_ITEM};
}
}
// Do for each delegate access item
if ( appendItems != null ) {
for ( int i = 0; i < appendItems.length; i++ ) {
// Read the item value
Vector values = profile.getItemValue(appendItems[i]);
// Add the name to the vector
values.add(name.getCanonical());
profile.replaceItemValue(appendItems[i], values);
}
}
}