📄 modifyentry.java
字号:
package com.remedy;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import com.andy.conn.ConnAR;
import com.andy.conn.GetFieldNameIDMap;
import com.remedy.arsys.api.ARException;
import com.remedy.arsys.api.ARServerUser;
import com.remedy.arsys.api.Entry;
import com.remedy.arsys.api.EntryCriteria;
import com.remedy.arsys.api.EntryFactory;
import com.remedy.arsys.api.EntryItem;
import com.remedy.arsys.api.EntryKey;
import com.remedy.arsys.api.EntryListFieldInfo;
public class ModifyEntry {
public int modifyEntryByQualification(String schema,HashMap map,HashMap mapQualification) throws IOException, ARException
{
int tag=0;
ArrayList fieldList=new ArrayList();
fieldList=GetFieldNameIDMap.getIDValueMap(schema,map);
EntryFactory entryMan = EntryFactory.getFactory();
Entry entry= (Entry)entryMan.newInstance();
ARServerUser context = new ConnAR().GetARServerUser();
entry.setContext(context);
EntryKey[] key=GeneralMethod.getEntryKey(schema,mapQualification);
if(key!=null)
{
for(int i=0;i<key.length;i++)
{
entry.setKey(key[i]);
EntryItem[] entryItems =GeneralMethod.getEntryItemList(fieldList);
entry.setEntryItems(entryItems);
entry.store();
}
tag=1;
System.out.println("modify success");
}
else
{
System.out.println("no this entry");
}
return tag;
}
public int modifyEntryByRequestID(String schema,HashMap map,String requestID) throws IOException, ARException
{
ArrayList fieldList=new ArrayList();
fieldList=GetFieldNameIDMap.getIDValueMap(schema,map);
return modifyEntryByRequestID(schema,fieldList,requestID);
}
public int modifyEntryByRequestID(String schema,ArrayList fieldList,String requestID) throws ARException, IOException
{
int tag=0;
EntryFactory entryMan = EntryFactory.getFactory();
Entry entry;
entry= (Entry)entryMan.newInstance();
ARServerUser context = new ConnAR().GetARServerUser();
entry.setContext(context);
// Get the Entry Key
EntryKey entryKey=GeneralMethod.getEntryKeyByRequestID(schema,requestID);
// Get the fields information
if(entryKey!=null)
{
System.out.println("test");
EntryListFieldInfo [] fieldlist = new EntryListFieldInfo[1];
EntryCriteria entryCriteria = new EntryCriteria();
entryCriteria.setEntryListFieldInfo(fieldlist) ;
entry=EntryFactory.findByKey(context, entryKey, entryCriteria);
EntryItem[] entryItems =GeneralMethod.getEntryItemList(fieldList);
entry.setEntryItems(entryItems);
entry.store();
tag=1;
System.out.println("modify success");
}
else
{
System.out.println("no this entry");
}
return tag;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -