Package org.martinlaw.bo

Examples of org.martinlaw.bo.MatterEvent


*/
public class EventTypeKeyValuesTest extends ScopedKeyValuesUifTestBase {

  @Override
  protected MatterExtensionHelper getTestDataObject() {
    return new MatterEvent();
  }
View Full Code Here


   * @throws IOException
   */
  @RequestMapping(value="/date")
  public ModelAndView downloadDate(@ModelAttribute("KualiForm"UifFormBase uifForm, HttpServletRequest request, 
      HttpServletResponse response, @RequestParam("uid") String uid) throws IOException {
    MatterEvent matterEvent = getMatterDate(uid);
    String template = IOUtils.toString(MatterEvent.class.getResourceAsStream(MartinlawConstants.VCALENDAR_TEMPLATE_FILE));
    if (StringUtils.isEmpty(template)) {
      throw new RuntimeException("The vcalendar template has not been defined in '" + MartinlawConstants.VCALENDAR_TEMPLATE_FILE + "'");
    }
    String calendar = matterEvent.toIcalendar(template);
    InputStream is = new ByteArrayInputStream(calendar.getBytes());
    String fileName = matterEvent.getMatter().getLocalReference() + "-" + matterEvent.getType().getName();
    getDownloadUtils().downloadAsStream(response, is, "text/calendar", calendar.length(),  fileName + ".ics");
   
    return getUIFModelAndView(uifForm);
  }
View Full Code Here

          "' does not match the pattern '" + MartinlawConstants.VCALENDAR_UID_PATTERN + "'");
    }
    // retrieve id from supplied uid
    Long id = Long.valueOf(calendarUid.substring(0, calendarUid.indexOf("-")));
    String className = calendarUid.substring(calendarUid.indexOf("-") + 1, calendarUid.indexOf("@"));
    MatterEvent matterEvent = null;
    try {
      matterEvent = (MatterEvent)Class.forName(className).newInstance();
    } catch (Exception e) {
      log.error("error while casting '" + className + "' into MatterEvent");
      throw new RuntimeException(e);
    }
    MatterEvent event = (MatterEvent) KRADServiceLocator.getBusinessObjectService().findBySinglePrimaryKey(matterEvent.getClass(), id);
    if (event == null) {
      throw new IllegalArgumentException("The event identified by '" + calendarUid + "' was not found");
    }
    return event;
  }
View Full Code Here

    kase.setConcreteClass(LandCase.class.getCanonicalName());
    inquirable.buildInquirableLink(kase, propertyName, inq);
    verify(inq).buildInquiryLink(same(kase), same(propertyName), same(LandCase.class), anyMapOf(String.class, String.class));
   
    // land case event should turn up a inquiry link to land case, not court case
    MatterEvent event = getBoSvc().findBySinglePrimaryKey(MatterEvent.class, new Long(1002));
    propertyName = "matter.localReference";
    inquirable.buildInquirableLink(event, propertyName, inq);
    verify(inq).buildInquiryLink(same(event), same(propertyName), same(LandCase.class), anyMapOf(String.class, String.class));
   
    // null local ref - no inquiry link should be built
    event = new MatterEvent();
    inquirable.buildInquirableLink(event, propertyName, inq);
    verify(inq, times(0)).buildInquiryLink(same(event), same(propertyName), same(LandCase.class), anyMapOf(String.class, String.class));

   
    // test for an object that is not in the Matter class hierarchy
View Full Code Here

   * Test method for {@link org.martinlaw.web.CalendarController#getMatterDate(java.lang.String)}.
   */
  @Test
  public void testGetMatterDate() {
    String uid1 = "1001-org.martinlaw.bo.courtcase.Event@mlaw.co.ke";
    MatterEvent matterEvent = controller.getMatterDate(uid1);
    assertNotNull("matter date should not be null", matterEvent);
    assertEquals("matter id differs", new Long(1001), matterEvent.getId());
  }
View Full Code Here

   *
   */
  @Test
  public void testMatterEventRouting() throws InstantiationException,
      IllegalAccessException, WorkflowException {
    MatterEvent testDate = getTestUtils().getTestMatterEventIT(getDataObjectClass());
    this.testMaintenanceRoutingInitToFinal(getDocTypeName(), testDate);
  }
View Full Code Here

   */
  @Test(expected = ValidationException.class)
  public void testMatterEventRouting_InvalidMatterId()
      throws InstantiationException, IllegalAccessException,
      WorkflowException {
    MatterEvent testDate = getTestUtils().getTestMatterEventIT(getDataObjectClass());
    testDate.setMatterId(3000l);
   
    /*//initiate as the clerk
    Document doc = getPopulatedMaintenanceDocument(getDocType(), testDate, "clerk1");
    KRADServiceLocatorWeb.getDocumentService().saveDocument(doc);*/
    testMaintenanceRoutingInitToFinal(getDocTypeName(), testDate);
View Full Code Here

   */
  @Test
  public void testMatterEventRouting_required_validated_onroute()
      throws InstantiationException, WorkflowException,
      IllegalAccessException {
    MatterEvent testDate = getTestUtils().getTestMatterEventIT(getDataObjectClass());
    // required on route
    testDate.setStartDate(null);
    testDate.setTypeId(null);
   
    //initiate as the clerk
    Document doc = getPopulatedMaintenanceDocument(getDocTypeName(), testDate, "clerk1");
    testRouting_required_validated_onroute(doc);
  }
View Full Code Here

  @Test
  public void testMatterEvent_doc_search() {
    try {
      // route 2 docs first
      MatterEvent testEvent1 = getTestUtils().getTestMatterEventIT(getDataObjectClass());
      final String docType = getDocTypeName();
      SimpleDateFormat sdf = new SimpleDateFormat("dd MMM yyyy hh:mm");
      Date date = sdf.parse("04 mar 2013 16:54");
      testEvent1.setStartDate(new Timestamp(date.getTime()));
      testMaintenanceRoutingInitToFinal(docType, testEvent1);
     
      MatterEvent testEvent2 = getTestUtils().getTestMatterEventIT(getDataObjectClass());
      String location = "nakuru";
      testEvent2.setLocation(location);
      testEvent2.setComment("optional for ict department");
      testEvent2.setStartDate(new Timestamp(System.currentTimeMillis()));
      testMaintenanceRoutingInitToFinal(docType, testEvent2);
     
      // blank document search
      SearchTestCriteria crit1 = new SearchTestCriteria();
      crit1.setExpectedDocuments(2);
View Full Code Here

   * @see org.martinlaw.bo.MatterEventTest#testToIcalendar()
   * @see org.martinlaw.bo.MatterEventMaintainableTest#testCreateNotificationMessage()
   * @return
   */
  public MatterEvent getTestMatterEventForStringTemplates() {
    MatterEvent caseEvent = new MatterEvent();
    caseEvent.setId(1001l);
    EventType eventType = new EventType();
    eventType.setName("judgement");
    caseEvent.setType(eventType);
   
    CourtCase theCase = new CourtCase();
    theCase.setLocalReference("my/cases/1");
    theCase.setName("water vs fire");
    theCase.setCourtReference("No 12 of 2015");
    theCase.setConcreteClass(CourtCase.class.getCanonicalName());
    caseEvent.setMatter(theCase);
   
    // create test date
    Calendar testCal = Calendar.getInstance();
    testCal.set(Calendar.YEAR, 2013);
    testCal.set(Calendar.MONTH, 1);// months start at 0
    testCal.set(Calendar.DATE, 22);
    testCal.set(Calendar.HOUR_OF_DAY, 11);
    testCal.set(Calendar.MINUTE, 19);
    testCal.set(Calendar.SECOND, 15);
   
    Date testDate = new Date(testCal.getTimeInMillis());
   
    caseEvent.setStartDate(new Timestamp(testDate.getTime()));
    Timestamp ts = new Timestamp(testCal.getTimeInMillis());
    caseEvent.setDateCreated(ts);
    caseEvent.setDateModified(ts);
    caseEvent.setLocation("Milimani");
    return caseEvent;
  }
View Full Code Here

TOP

Related Classes of org.martinlaw.bo.MatterEvent

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.