Exemplo n.º 1
0
  @RequestMapping(value = "/item/create.do", method = RequestMethod.POST)
  public ModelAndView create(ItemVO itemVO, HttpServletRequest request) {
    // System.out.println("--> create() POST called.");
    ModelAndView mav = new ModelAndView();
    mav.setViewName("/item/message");

    ArrayList<String> msgs = new ArrayList<String>();
    ArrayList<String> links = new ArrayList<String>();

    if (itemDAO.create(itemVO) == 1) {
      msgs.add("글을 등록했습니다.");
      links.add("<button type='button' onclick=\"location.href='./create.do'\">계속 등록</button>");
    } else {
      msgs.add("글 등록에 실패했습니다.");
      msgs.add("다시 시도해주세요.");
      links.add("<button type='button' onclick=\"history.back()\">다시시도</button>");
    }

    links.add("<button type='button' onclick=\"location.href='./home.do'\">홈페이지</button>");
    links.add(
        "<button type='button' onclick=\"location.href='./list2.do?itemno="
            + itemVO.getItemno()
            + "'\">목록</button>");
    mav.addObject("msgs", msgs);
    mav.addObject("links", links);

    return mav;
  }
Exemplo n.º 2
0
  @RequestMapping(value = "/item/list.do", method = RequestMethod.GET)
  public ModelAndView list() {
    ModelAndView mav = new ModelAndView();
    mav.setViewName("/item/list");
    mav.addObject("list", itemDAO.list());

    return mav;
  }
Exemplo n.º 3
0
  static void updateAppWidget(Context context, AppWidgetManager appWidgetManager, int appWidgetId) {

    // 讀取小工具儲存的記事編號
    long id = ItemAppWidgetConfigureActivity.loadItemPref(context, appWidgetId);
    // 建立小工具畫面元件
    RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.item_app_widget);
    // 讀取指定編號的記事物件
    ItemDAO itemDAO = new ItemDAO(context.getApplicationContext());
    Item item = itemDAO.get(id);

    // 設定小工具畫面顯示記事標題
    views.setTextViewText(R.id.appwidget_text, item != null ? item.getTitle() : "NA");

    // 點選小工具畫面的記事標題後,啟動記事應用程式
    Intent intent = new Intent(context, MainActivity.class);
    PendingIntent pending = PendingIntent.getActivity(context, 0, intent, 0);
    views.setOnClickPendingIntent(R.id.appwidget_text, pending);

    // 更新小工具
    appWidgetManager.updateAppWidget(appWidgetId, views);
  }
  /**
   * Creates a matrix to process genre data and generate the first factor of the proximity matrix
   * needed for a {@code HIRItemScorer}.
   *
   * @param dao The DataAccessObject interfacing with the item data for the model
   * @param gDao The genreDataAccessObject interfacing with the genre data for the model
   */
  public RowStochasticFactorOfProximity(ItemDAO dao, ItemGenreDAO gDao) {
    LongSet items = dao.getItemIds();
    int genreSize = gDao.getGenreSize();
    itemSize = items.size();
    double[][] data = new double[itemSize][genreSize];

    rowStochastic = MatrixUtils.createRealMatrix(data);

    int i = 0;
    LongIterator iter = items.iterator();
    while (iter.hasNext()) {
      long item = iter.nextLong();
      rowStochastic.setRowVector(i, gDao.getItemGenre(item));
      i++;
    }
  }
Exemplo n.º 5
0
 public void testTimestamp() throws Exception {
   ItemDAO iDAO = (ItemDAO) ctx.getBean("itemDAO");
   java.util.Collection c = iDAO.getItemsForUser("vec", new java.util.Date());
   System.out.println("hihi");
 }