Package com.google.appengine.api.datastore

Examples of com.google.appengine.api.datastore.Transaction


     * ユーザ情報の取得
     * @param uid ユーザID
     * @return ユーザ情報
     */
    public User get(String uid) {
        Transaction tx = Datastore.beginTransaction();
        User result = this.get(tx, uid);
        tx.commit();
        return result;
    }
View Full Code Here


     * パスワードの保存
     * @param uid ユーザID
     * @param password パスワード
     */
    public void savePassword(String uid, String password) {
        Transaction tx = Datastore.beginTransaction();
        User user = Datastore.getOrNull(tx, UserMeta.get(), UserService.createKey(uid));
        user.setInitialKey("");
        user.setPassword(password);
        Datastore.put(tx, user);
        tx.commit();
    }
View Full Code Here

            }
        }

        layout.setManagerRef(manager);

        Transaction tx = Datastore.beginTransaction();
        layout.setManagerRef(manager);
        Datastore.put(tx, layout);
        tx.commit();
    }
View Full Code Here

     * @param lid
     *            レイアウトID
     * @return レイアウト情報
     */
    public Layout get(User user, long lid) {
        Transaction tx = Datastore.beginTransaction();
        Layout result = this.get(tx, user, lid);
        tx.commit();
        return result;
    }
View Full Code Here

        }
        return null;
    }

    public void delete(User user, List<Long> lids) {
        Transaction tx = Datastore.beginTransaction();
        this.delete(tx, user, lids);
        tx.commit();
    }
View Full Code Here

        final String name = "Test User";
        final String mail = "testuser@mail.com";
        final String phone = "052-551-1861";
        final String zipcode = "450-0002";
        final String address = "架空の住所";
        Transaction tx = Datastore.beginTransaction();
        User user = service.put(tx, uid, name, mail, phone, zipcode, address);
        assertThat(user, is(notNullValue()));
        assertThat(user, instanceOf(Manager.class));
        Manager manager = (Manager)user;
        assertThat(manager.getName(), is(name));
        assertThat(manager.getMail().getEmail(), is(mail));
        assertThat(manager.getPhone().getNumber(), is(phone));
        assertThat(manager.getZipcode(), is(zipcode));
        assertThat(manager.getAddress().getAddress(), is(address));

        assertNotNull(user.getInitialKey());
        assertThat(user.getInitialKey(), not(""));

        Manager stored = Datastore.getOrNull(Manager.class, user.getUid());
        assertThat(stored, is(nullValue()));

        tx.commit();
        stored = Datastore.getOrNull(Manager.class, user.getUid());
        assertThat(stored, instanceOf(Manager.class));
        manager = (Manager)stored;
        assertThat(manager.getName(), is(name));
        assertThat(manager.getMail().getEmail(), is(mail));
View Full Code Here

     *
     * @param timeline
     *            タイムライン情報
     */
    public void put(Manager manager, TimeLine timeline) {
        Transaction tx = Datastore.beginTransaction();
        // XMLモデルを文字列に変換
        TimeLineXml xmlModel = timeline.getXmlModel();
        if (xmlModel != null) {
            try {
                StringWriter writer = new StringWriter();
                JAXBContext context =
                    JAXBContext.newInstance("jp.co.nskint.uq.pd.signage.model.xml");
                context.createMarshaller().marshal(xmlModel, writer);
                timeline.setXml(writer.toString());
            } catch (JAXBException e) {
                throw new IllegalStateException(e);
            }
        }
        timeline.getManagerRef().setModel(manager);
        Datastore.put(tx, timeline);
        tx.commit();
    }
View Full Code Here

     * @param tlid
     *            タイムラインID
     * @return タイムライン情報
     */
    public TimeLine get(long tlid) {
        Transaction tx = Datastore.beginTransaction();
        TimeLine result = this.get(tx, tlid);
        tx.commit();
        return result;
    }
View Full Code Here

     * 掲示板情報の取得
     * @param bid 掲示板ID
     * @return 掲示板情報
     */
    public Board get(long bid) {
        Transaction tx = Datastore.beginTransaction();
        Board result = this.get(tx, bid);
        tx.commit();
        return result;
    }
View Full Code Here

     * @param bid 掲示板ID
     * @param title タイトル
     * @return
     */
    public Board put(long bid, String title) {
        Transaction tx = Datastore.beginTransaction();
        Board result = put(tx, bid, title);

        tx.commit();

        return result;
    }
View Full Code Here

TOP

Related Classes of com.google.appengine.api.datastore.Transaction

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.