Examples of BeeTranslationService


Examples of org.sf.bee.mongodb.i18n.BeeTranslationService

    public final void addLocalization(final String collection,
            final Object id, final String lang, final String field,
            final Object value) {
        try {
            final BeeTranslationService srvc = new BeeTranslationService(_db);
            srvc.add(collection, id, field, lang, value);
        } catch (Throwable ex) {
        }
    }
View Full Code Here

Examples of org.sf.bee.mongodb.i18n.BeeTranslationService

        return this.removeLocalizations(id);
    }

    public final int removeLocalizations(final Object id) {
        try {
            final BeeTranslationService srvc = new BeeTranslationService(_db);
            return srvc.removeAll(_collName, id);
        } catch (Throwable ex) {
        }
        return -1;
    }
View Full Code Here

Examples of org.sf.bee.mongodb.i18n.BeeTranslationService

    }

    public final void removeLocalization(final String collection,
            final Object id, final String lang, final String field) {
        try {
            final BeeTranslationService srvc = new BeeTranslationService(_db);
            srvc.remove(collection, id, field, lang);
        } catch (Throwable ex) {
        }
    }
View Full Code Here

Examples of org.sf.bee.mongodb.i18n.BeeTranslationService

    public final void localize(final String collection, final DBObject item,
            final String lang, final String[] fields) {
        if (null != item && StringUtils.hasText(lang)) {
            try {
                final Object id = getId(item);
                final BeeTranslationService srvc = new BeeTranslationService(_db);
                for (final String field : fields) {
                    final Object value = srvc.get(collection, id, field, lang);
                    if (!StringUtils.isNULL(value)) {
                        item.put(field, value);
                    } else {
                        // value is not replaced
                        // this.getLogger().info(StringUtils.format( "value not replaced for '{0}'. Keep original '{1}'", field, item.get(field)));
View Full Code Here

Examples of org.sf.bee.mongodb.i18n.BeeTranslationService

     * @return List of fieldIds.
     */
    public final List<String> getTranslatedFieldIds(final String lang,
            final String collection, final String filterText) {
        try {
            final BeeTranslationService srvc = new BeeTranslationService(_db);
            final DBObject fTranslations = new BasicDBObject();
            final Pattern pattern = Pattern.compile("^.*".concat(filterText).concat(".*$"), Pattern.CASE_INSENSITIVE);
            fTranslations.put(BeeTranslation.COLL, collection);
            fTranslations.put(BeeTranslation.LANG, lang);
            fTranslations.put(BeeTranslation.VALUE, pattern);
            return srvc.distinct(BeeTranslation.FIELD_ID, fTranslations);
        } catch (Exception ex) {
            this.getLogger().log(Level.SEVERE, ex.getMessage());
        }
        return new ArrayList<String>();
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.