示例#1
0
  public void execute() {
    // Initialize a Reminder or more than one Reminders.
    boolean booleanReminder = false;
    if (mStrReminder.compareTo(mStrReminder) == 0) booleanReminder = true;
    Reminder[] reminders = new Reminder[1];
    if (mStrMinute.compareTo("On day of event") == 0) {
      Date dateReminder = getDateTime(mStrStartTime);
      GregorianCalendar gregorianCalendarReminder = new GregorianCalendar();
      gregorianCalendarReminder.setTime(dateReminder);
      mStrMinute =
          Integer.toString(
              gregorianCalendarReminder.get(Calendar.HOUR_OF_DAY) * 60
                  + gregorianCalendarReminder.get(Calendar.MINUTE));
    }

    reminders[0] = new Reminder(mStrMinute, mStrMethod, booleanReminder);

    // Initialize a Recurrence.

    // Initialize a Where.
    Where where = new Where(mStrLocation);

    // Initialize a When.
    When when =
        new When(
            getStrDateWithTimeZone(mStrStartTime), getStrDateWithTimeZone(mStrEndTime), reminders);

    // Initialize an Event.
    Event event = new Event(mStrTitle, mStrContent, where, when);

    // Post to Calendar for adding a new event of default calendar.
    Event eventNew = null;
    try {
      eventNew = mCalendarServer.postEventEntry("", event);
    } catch (IOException e) {
      Bundle bundleSend = new Bundle();
      eventNew = new Event(false);
      bundleSend.putSerializable("Data", eventNew);
      bundleSend.putInt("ErrorCode", Integer.parseInt(e.getMessage()));

      Intent intentSend = new Intent(IntentCommand.INTENT_ACTION);
      intentSend.setFlags(IntentCommand.GOOGLE_CALENDAR_ADD_EVENT);
      intentSend.putExtras(bundleSend);

      mBaseService.sendBroadcast(intentSend);
      return;
    }

    // Get a response from Calendar, the response is a event entry, update cache.
    if (eventNew != null) {
      Bundle bundleSend = new Bundle();
      bundleSend.putSerializable("Data", eventNew);

      Intent intentSend = new Intent(IntentCommand.INTENT_ACTION);
      intentSend.setFlags(IntentCommand.GOOGLE_CALENDAR_ADD_EVENT);
      intentSend.putExtras(bundleSend);

      mBaseService.sendBroadcast(intentSend);
    }
  }
示例#2
0
 public void removedBundle(Bundle bundle, BundleEvent event, Object object) {
   LOG.debug("Bundle stopped: {}", bundle.getSymbolicName());
   List<BaseService> r = resolvers.remove(bundle.getBundleId());
   if (r != null) {
     for (BaseService service : r) {
       service.unregister();
     }
   }
 }
示例#3
0
 public Object addingBundle(Bundle bundle, BundleEvent event) {
   LOG.debug("Bundle started: {}", bundle.getSymbolicName());
   List<BaseService> r = new ArrayList<BaseService>();
   registerComponents(bundle, r);
   registerLanguages(bundle, r);
   registerDataFormats(bundle, r);
   registerTypeConverterLoader(bundle, r);
   for (BaseService service : r) {
     service.register();
   }
   resolvers.put(bundle.getBundleId(), r);
   return bundle;
 }
  @Override
  public synchronized void stop() {

    setFutureClose(getChannel().close());

    super.stop();
  }
 /**
  * Checks if the container properly initialized the injected fields.
  *
  * @throws ConfigurationException if any injected field is null
  */
 @PostConstruct
 protected void init() {
   super.init();
   if (hospiceLicensingDAO == null) {
     throw new ConfigurationException("The hospiceLicensingDAO must be configured.");
   }
 }
  @Override
  public synchronized void start() {

    super.start();

    final ClientBootstrap boot = new ClientBootstrap();

    boot.setOption("reuseAddress", true);

    boot.setOption(
        "receiveBufferSize", //
        getNetPoint().getReceiveBufferSize());

    boot.setOption(
        "sendBufferSize", //
        getNetPoint().getSendBufferSize());

    boot.setFactory(getChannelFactory());

    setFutureConnect(
        boot.connect( //
            getNetPoint().getRemoteAddress(), //
            getNetPoint().getLocalAddress()));

    setChannel(getFutureConnect().getChannel());
  }
示例#7
0
  @Override
  public String[] changePwd(String user_id, String old_pass, String new_pass) {
    old_pass = StringUtil.isEmpty(old_pass);

    // TODO
    User user = selectByKey(user_id);
    if (null == user) return new String[] {"用户不存在"};

    // TODO
    if (!MD5.encode(old_pass).equals(user.getUser_pass())) return new String[] {"原始密码错误"};

    User _user = new User();
    _user.setId(user_id);
    _user.setUser_pass(MD5.encode(new_pass));
    super.updateNotNull(_user);

    return null;
  }
  public void save(Reserva reserva) throws ServiceException {

    if (reserva.getCampo() == null) {

      throw new ServiceException("Informe o campo");
    }

    if (reserva.getDataReserva() == null) {

      throw new ServiceException("Informe a dia da reserva");
    }

    if (reserva.getHoraReserva() == null) {

      throw new ServiceException("Informe a hora da reserva");
    }

    if (reserva.getUsuario() == null) {

      throw new ServiceException("Ocorreu um erro ao cadastrar, usuario nulo");
    }

    Reserva _reserva =
        (Reserva)
            oneByQuery(
                "SELECT r FROM Reserva r WHERE r.campo.id = ? AND r.dataReserva = ? AND r.horaReserva = ?",
                reserva.getCampo().getId(),
                reserva.getDataReserva(),
                reserva.getHoraReserva());

    if (_reserva != null) {

      throw new ServiceException("Este campo já esta reservado nesta hora");
    }

    reserva.setDataCadastro(Calendar.getInstance());
    reserva.setCampo(getEntityManager().find(Campo.class, reserva.getCampo().getId()));
    reserva.setUsuario(getEntityManager().find(Usuario.class, reserva.getUsuario().getId()));

    super.save(reserva);
  }
示例#9
0
  @Test
  public void baseService() throws Exception {
    BaseService service = new MyService();
    assertNull(service.getInterface());
    assertEquals(service.getPrefix(), "myservice");
    assertEquals(service.getServiceDependencies().length, 0);

    Server server = Mockito.mock(Server.class);
    Configuration conf = new Configuration(false);
    conf.set("server.myservice.foo", "FOO");
    conf.set("server.myservice1.bar", "BAR");
    Mockito.when(server.getConfig()).thenReturn(conf);
    Mockito.when(server.getPrefixedName("myservice.foo")).thenReturn("server.myservice.foo");
    Mockito.when(server.getPrefixedName("myservice.")).thenReturn("server.myservice.");

    service.init(server);
    assertEquals(service.getPrefixedName("foo"), "server.myservice.foo");
    assertEquals(service.getServiceConfig().size(), 1);
    assertEquals(service.getServiceConfig().get("foo"), "FOO");
    assertTrue(MyService.INIT);
  }
示例#10
0
 public PageInfo<Comment> getDataPaging(int pageNum, int pageSize) {
   // TODO Auto-generated method stub
   return baseService.getDataPaging(pageNum, pageSize, commentMapper);
 }
 @Override
 public void onDestroy() {
   super.onDestroy();
   EMChatHelper.getInstance().removeEventListener(eventListener);
 }
示例#12
0
 @Override
 public void destroy() {
   assertEquals(getServer().getStatus(), Server.Status.SHUTTING_DOWN);
   super.destroy();
 }
示例#13
0
 public void insertUserList(List<User> list) {
   super.insert("insertUserList", list);
   // super.batch("insertUserList",list,OperationType.insert);
 }
示例#14
0
 public int deleteRecordByPrimaryKey(int primaryKey) throws Exception {
   // TODO Auto-generated method stub
   return baseService.deleteRecordByPrimaryKey(primaryKey, commentMapper);
 }
示例#15
0
 public int updateRecordByPrimaryKeySelective(Comment record) throws Exception {
   // TODO Auto-generated method stub
   return baseService.updateRecordByPrimaryKeySelective(record, commentMapper);
 }
 @Override
 public void onCreate() {
   super.onCreate();
   initEMChatEvent();
 }
示例#17
0
 public int insertRecord(Comment record) throws Exception {
   // TODO Auto-generated method stub
   return baseService.insertRecord(record, commentMapper);
 }