Search in sources :

Example 6 with DataRecord

use of org.aspcfs.apps.transfer.DataRecord in project opennms by OpenNMS.

the class CentricAPITest method testCreateTicket.

public void testCreateTicket() {
    CRMConnection crm = createConnection();
    ArrayList<String> sucky = new ArrayList<>();
    sucky.add("id");
    crm.setTransactionMeta(sucky);
    DataRecord email = new DataRecord();
    email.setName("ticket");
    email.setAction(DataRecord.INSERT);
    email.setShareKey(true);
    // email.addField("orgId", 1);
    // email.addField("contactId", 1);
    email.addField("problem", "can't get there from here");
    email.addField("enteredBy", 0);
    email.addField("modifiedBy", 0);
    crm.save(email);
    commit(crm);
    assertEquals(1, crm.getRecordCount());
    @SuppressWarnings("unchecked") List<RecordLocator> results = crm.getRecords(RecordLocator.class.getName());
    assertEquals(1, results.size());
    RecordLocator record = results.get(0);
    assertTrue(0 < record.getIdAsInt());
/*
        <map class="org.aspcfs.modules.troubletickets.base.Ticket" id="ticket">
        <property alias="guid">id</property>
        <property lookup="account">orgId</property>
        <property lookup="contact">contactId</property>
        <property>problem</property>
        <property>entered</property>
        <property lookup="user">enteredBy</property>
        <property>modified</property>
        <property lookup="user">modifiedBy</property>
        <property>closed</property>
        <property lookup="ticketPriority">priorityCode</property>
        <property>levelCode</property>
        <property lookup="lookupDepartment">departmentCode</property>
        <property lookup="lookupTicketSource">sourceCode</property>
        <property lookup="ticketCategory">catCode</property>
        <property lookup="ticketCategory">subCat1</property>
        <property lookup="ticketCategory">subCat2</property>
        <property lookup="ticketCategory">subCat3</property>
        <property lookup="user">assignedTo</property>
        <property>comment</property>
        <property>solution</property>
        <property lookup="ticketSeverity">severityCode</property>
        <!-- REMOVE: critical -->
        <!-- REMOVE: notified -->
        <!-- REMOVE: custom_data -->    
        <property>location</property>
        <property>assignedDate</property>
        <property>estimatedResolutionDate</property>
        <property>resolutionDate</property>
        <property>cause</property>
        <property>contractId</property>
        <property>assetId</property>
        <property>productId</property>
        <property>customerProductId</property>
        <property>expectation</property>
        <property>projectTicketCount</property>
        <property>estimatedResolutionDateTimeZone</property>
        <property>assignedDateTimeZone</property>
        <property>resolutionDateTimeZone</property>
        <property>statusId</property>
        <property>trashedDate</property>
        <property>userGroupId</property>
        <property>causeId</property>
        <property>resolutionId</property>
        <property>defectId</property>
        <property>escalationLevel</property>
        <property>resolvable</property>
        <property>resolvedBy</property>
        <property>resolvedByDeptCode</property>
        <property>stateId</property>
        <property>siteId</property>
      </map>
      
*/
}
Also used : ArrayList(java.util.ArrayList) DataRecord(org.aspcfs.apps.transfer.DataRecord) CRMConnection(org.aspcfs.utils.CRMConnection)

Aggregations

DataRecord (org.aspcfs.apps.transfer.DataRecord)6 ArrayList (java.util.ArrayList)4 CRMConnection (org.aspcfs.utils.CRMConnection)3 DataRetrievalFailureException (org.springframework.dao.DataRetrievalFailureException)2 Map (java.util.Map)1 Properties (java.util.Properties)1 Ticket (org.opennms.api.integration.ticketing.Ticket)1