/** * Search data from Remedy search and in case of matching it will return a list of records * * @param entry <code>CoreItem</code> structure used by read or search process * @return <code>CoreItem</code> structure returned by read operation * @throws AREasyException in case any error occurs */ protected List searchData(CoreItem entry) throws AREasyException { String id = getConfiguration().getString("id", null); if (StringUtility.isNotEmpty(id)) entry.setAttribute(1, id); if (getConfiguration().getString("qualification", null) == null) { setQueryFields(entry); int chunk = getConfiguration().getInt("chunk", 0); if (chunk > 0) { if (getConfiguration().containsKey("nextchunkid")) entry.setAttribute(1, ">" + getConfiguration().getString("nextchunkid")); return entry.search(getServerConnection(), chunk); } else return entry.search(getServerConnection()); } else { String qualification = getTranslatedQualification(getConfiguration().getString("qualification", null)); int limit = getConfiguration().getInt("limit", 0); if (limit > 0) { if (getConfiguration().containsKey("chunk")) getConfiguration().removeKey("chunk"); return entry.search(getServerConnection(), qualification, limit); } else { int chunk = getConfiguration().getInt("chunk", 0); if (getConfiguration().containsKey("nextchunkid")) qualification = "('1'>\"" + getConfiguration().getString("nextchunkid") + "\") AND (" + qualification + ")"; return entry.search(getServerConnection(), qualification, chunk); } } }
/** * Execute an action for a specific <code>CoreItem</code>. This item must be identified previously * and then the method could be called. This method will used by standard actions which implement * an workflow using these type of action which permit single change or update. * * @param entry <code>CoreItem</code> structure, which should be instantiated. * @throws org.areasy.runtime.engine.base.AREasyException if any error will occur. */ public void run(CoreItem entry) throws AREasyException { String operation = getConfiguration().getString("operation", null); if (StringUtility.equalsIgnoreCase(operation, "insert") || StringUtility.equalsIgnoreCase(operation, "create")) runCreate(entry); else if (StringUtility.equalsIgnoreCase(operation, "update") || StringUtility.equalsIgnoreCase(operation, "modify")) runUpdate(entry); else if (StringUtility.equalsIgnoreCase(operation, "delete") || StringUtility.equalsIgnoreCase(operation, "remove")) runRemove(entry); else if (StringUtility.equalsIgnoreCase(operation, "merge")) runMerge(entry); }
/** * Read data from Remedy search and in case of matching it will return only one record * * @param entry <code>CoreItem</code> structure used by read or search process * @return <code>CoreItem</code> structure returned by read operation * @throws AREasyException in case any error occurs */ protected CoreItem readData(CoreItem entry) throws AREasyException { String id = getConfiguration().getString("id", null); if (StringUtility.isNotEmpty(id)) entry.setAttribute(1, id); if (getConfiguration().getString("qualification", null) == null) { setQueryFields(entry); entry.read(getServerConnection()); } else { String qualification = getTranslatedQualification(getConfiguration().getString("qualification", null)); entry.read(getServerConnection(), qualification); } return entry; }