Package models

Examples of models.DynamicField


@SecureSocial.SecuredAction(ajaxCall = true)
public class DynamicFieldRestController extends BaseController {

    public static Result get(Long idDynamicField) {
        DynamicField dynamicField = DynamicField.find.byId(idDynamicField);
        if (dynamicField == null) {
            return noContent();
        }
        return ok(toJson(dynamicField));
    }
View Full Code Here


        if (dynamicFieldForm.hasErrors()) {
            return badRequest(toJson(TransformValidationErrors.transform(dynamicFieldForm.errors())));
        }

        DynamicField formDynamicField = dynamicFieldForm.get();

        if (formDynamicField.getId() == null) {
            // Nouveau dynamicField
            if (DynamicField.findByName(formDynamicField.getName()) != null) {
                return badRequest(toJson(TransformValidationErrors.transform(Messages.get("error.dynamicField.already.exist"))));
            }
            formDynamicField.save();
        } else {
            // Mise à jour d'un dynamicField
            DynamicField dbDynamicField = DynamicField.find.byId(formDynamicField.getId());
            if (!formDynamicField.getName().equals(dbDynamicField.getName())
                    && DynamicField.findByName(formDynamicField.getName()) != null) {
                return badRequest(toJson(TransformValidationErrors.transform(Messages.get("error.dynamicField.already.exist"))));
            }
            dbDynamicField.setName(formDynamicField.getName());
            dbDynamicField.update();
        }
        // HTTP 204 en cas de succès (NO CONTENT)
        return noContent();
    }
View Full Code Here

        User user = getLoggedUser();
        if (!user.admin) {
            return forbidden();
        }

        DynamicField dynamicField = DynamicField.find.byId(idDynamicField);
        if (dynamicField != null) {
            for (DynamicFieldValue value : dynamicField.getDynamicFieldValues()) {
                value.delete();
            }
            dynamicField.delete();
        }
        // HTTP 204 en cas de succès (NO CONTENT)
        return noContent();
    }
View Full Code Here

TOP

Related Classes of models.DynamicField

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.