Package gaej2011.meta

Examples of gaej2011.meta.KeyWordMeta


    @Override
    protected Navigation run() throws Exception {
        String query = asString("query");
        Set<String> keyWords = YahooAPIService.parse(query);
        KeyWordMeta keyWordMeta = KeyWordMeta.get();
        // 検索対象となるのはKeyWord エンティティ
        ModelQuery<KeyWord> modelQuery = Datastore.query(keyWordMeta);
        for (String keyWord : keyWords) {
            // すべてのキーワードをEQ フィルタとして追加し、すべてのキーワードにマッチする、というクエリを組み立てる
            modelQuery.filter(keyWordMeta.words.equal(keyWord));
View Full Code Here


            .filter(meta.updatedAt.greaterThan(before48hours))
            .asKeyList();
    }

    public static void updateMemoCount(Key minutesKey) {
        MemoMeta memoMeta = MemoMeta.get();
        int memoCount =
            Datastore
                .query(memoMeta)
                .filter(memoMeta.minutes.equal(minutesKey))
                .count();
View Full Code Here

            Datastore.getAsMap(AccessCounter.class, countMap.keySet());
        Iterator<Entry<Key, Integer>> i = countMap.entrySet().iterator();
        while (i.hasNext()) {
            Entry<Key, Integer> next = i.next();
            Key counterKey = next.getKey();
            AccessCounter counter;
            if (counterEntitiesMap.containsKey(counterKey)) {
                counter = counterEntitiesMap.get(counterKey);
            } else {
                counter = new AccessCounter();
                counterEntitiesMap.put(counterKey, counter);
                counter.setKey(counterKey);
                Minutes minutes =
                    Datastore.get(
                        Minutes.class,
                        Datastore.createKey(Minutes.class, counterKey.getId()));
                counter.setMinutesTitle(minutes.getTitle());
            }
            counter.setCount(counter.getCount() + next.getValue());
        }
        return counterEntitiesMap.values();
    }
View Full Code Here

        assertThat(
            " レスポンスコードが200",
            tester.response.getStatus(),
            is(HttpServletResponse.SC_OK));
        String json = tester.response.getOutputAsString();
        AuthDTO dto = AuthDTOMeta.get().jsonToModel(json);
        assertThat(" ログイン中でない", dto.isLoggedIn(), is(false));
        assertThat(" ログイン用URL が返される", dto.getLoginURL(), is(notNullValue()));
        assertThat(" ログアウト用URL は返されない", dto.getLogoutURL(), is(nullValue()));
    }
View Full Code Here

        assertThat(
            " レスポンスコードが200",
            tester.response.getStatus(),
            is(HttpServletResponse.SC_OK));
        String json = tester.response.getOutputAsString();
        AuthDTO dto = AuthDTOMeta.get().jsonToModel(json);
        assertThat(" ログイン中", dto.isLoggedIn(), is(true));
        assertThat(" ログイン用URL は返されない", dto.getLoginURL(), is(nullValue()));
        assertThat(" ログアウト用URL が返される", dto.getLogoutURL(), is(notNullValue()));
    }
View Full Code Here

public class AuthController extends Controller {

    @Override
    protected Navigation run() throws Exception {
        UserService userService = UserServiceFactory.getUserService();
        AuthDTO authDTO = new AuthDTO();
        if (userService.isUserLoggedIn()) {
            authDTO.setLoggedIn(true);
            authDTO.setLogoutURL(userService.createLogoutURL("/"));
        } else {
            authDTO.setLoggedIn(false);
            authDTO.setLoginURL(userService.createLoginURL("/"));
        }
        response.setCharacterEncoding("utf-8");
        response.setContentType("application/json");
        response.getWriter().println(AuthDTOMeta.get().modelToJson(authDTO));
        response.flushBuffer();
View Full Code Here

    }

    @Test
    public void saveToDatastore_entityの内容() {
        Key key = GuestbookService.saveToDatastore(" 投稿内容");
        Guestbook guestbook = Datastore.get(Guestbook.class, key);
        assertThat(" 投稿内容が保存されている", guestbook.getMessage(), is(" 投稿内容"));
        assertThat(
            " 保存日時が保存されている",
            guestbook.getCreatedAt(),
            is(notNullValue()));
    }
View Full Code Here

    @Test
    public void queryFromDatastore() {
        Calendar calendar = Calendar.getInstance();
        for (int i = 0; i < 5; i++) { // 5 件保存しておく
            Guestbook guestbook = new Guestbook();
            guestbook.setMessage(" 投稿内容" + i);
            guestbook.setCreatedAt(calendar.getTime());
            Datastore.put(guestbook);
            calendar.add(Calendar.HOUR_OF_DAY, 1); // 1 時間進める
        }
        int count = 0;
        Date before = null;
View Full Code Here

import com.google.appengine.api.datastore.Key;

public class GuestbookService {

    public static Key saveToDatastore(String string) {
        Guestbook guestbook = new Guestbook();
        guestbook.setMessage(string);
        guestbook.setCreatedAt(new Date());
        Datastore.put(guestbook);
        return guestbook.getKey();
    }
View Full Code Here

    @Test
    public void get() throws NullPointerException, IllegalArgumentException,
            IOException, ServletException {
        Calendar calendar = Calendar.getInstance();
        for (int i = 0; i < 5; i++) { // 5 件保存しておく
            Guestbook guestbook = new Guestbook();
            guestbook.setMessage(" 投稿内容" + i);
            guestbook.setCreatedAt(calendar.getTime());
            Datastore.put(guestbook);
            calendar.add(Calendar.HOUR_OF_DAY, 1); // 1 時間進める
        }
        tester.request.setMethod("GET");
        tester.start("/guestbook");
View Full Code Here

TOP

Related Classes of gaej2011.meta.KeyWordMeta

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.