@Override public void setValidationStampImage(ID validationStampId, Document document) { getNamedParameterJdbcTemplate().update( "UPDATE VALIDATION_STAMPS SET IMAGETYPE = :type, IMAGEBYTES = :content WHERE ID = :id", params("id", validationStampId.getValue()) .addValue("type", Document.isValid(document) ? document.getType() : null) .addValue("content", Document.isValid(document) ? document.getContent() : null) ); }
@Override public void setPredefinedValidationStampImage(ID predefinedValidationStampId, Document document) { getNamedParameterJdbcTemplate().update( "UPDATE PREDEFINED_VALIDATION_STAMPS SET IMAGETYPE = :type, IMAGEBYTES = :content WHERE ID = :id", params("id", predefinedValidationStampId.getValue()) .addValue("type", Document.isValid(document) ? document.getType() : null) .addValue("content", Document.isValid(document) ? document.getContent() : null) ); }
@Override public void setPredefinedPromotionLevelImage(ID predefinedPromotionLevelId, Document document) { getNamedParameterJdbcTemplate().update( "UPDATE PREDEFINED_PROMOTION_LEVELS SET IMAGETYPE = :type, IMAGEBYTES = :content WHERE ID = :id", params("id", predefinedPromotionLevelId.getValue()) .addValue("type", Document.isValid(document) ? document.getType() : null) .addValue("content", Document.isValid(document) ? document.getContent() : null) ); }
private void copyPromotionLevelContent(PromotionLevel sourcePromotionLevel, PromotionLevel targetPromotionLevel) { // Copy of the image Document image = structureService.getPromotionLevelImage(sourcePromotionLevel.getId()); if (Document.isValid(image)) { structureService.setPromotionLevelImage(targetPromotionLevel.getId(), image); } // Copy of properties doCopyProperties(sourcePromotionLevel, targetPromotionLevel, replacementFn, syncPolicy); } }
private void copyValidationStampContent(ValidationStamp sourceValidationStamp, ValidationStamp targetValidationStamp) { // Copy of the image Document image = structureService.getValidationStampImage(sourceValidationStamp.getId()); if (Document.isValid(image)) { structureService.setValidationStampImage(targetValidationStamp.getId(), image); } // Copy of properties doCopyProperties(sourceValidationStamp, targetValidationStamp, replacementFn, syncPolicy); } }
@Override public void bulkUpdatePromotionLevels(ID promotionLevelId) { // Description & name PromotionLevel promotionLevel = getPromotionLevel(promotionLevelId); String description = promotionLevel.getDescription(); String name = promotionLevel.getName(); // Image Document image = getPromotionLevelImage(promotionLevelId); // Bulk update getNamedParameterJdbcTemplate().update( "UPDATE PROMOTION_LEVELS SET IMAGETYPE = :type, IMAGEBYTES = :content, DESCRIPTION = :description " + "WHERE ID <> :id AND NAME = :name", params("id", promotionLevelId.getValue()) .addValue("name", name) .addValue("description", description) .addValue("type", Document.isValid(image) ? image.getType() : null) .addValue("content", Document.isValid(image) ? image.getContent() : null) ); }
@Override public void bulkUpdateValidationStamps(ID validationStampId) { // Description & name ValidationStamp validationStamp = getValidationStamp(validationStampId); String description = validationStamp.getDescription(); String name = validationStamp.getName(); // Image Document image = getValidationStampImage(validationStampId); // Bulk update getNamedParameterJdbcTemplate().update( "UPDATE VALIDATION_STAMPS SET IMAGETYPE = :type, IMAGEBYTES = :content, DESCRIPTION = :description, " + "DATA_TYPE_ID = :dataTypeId, DATA_TYPE_CONFIG = CAST(:dataTypeConfig AS JSONB) " + "WHERE ID <> :id AND NAME = :name", params("id", validationStampId.getValue()) .addValue("name", name) .addValue("description", description) .addValue("type", Document.isValid(image) ? image.getType() : null) .addValue("content", Document.isValid(image) ? image.getContent() : null) .addValue("dataTypeId", validationStamp.getDataType() != null ? validationStamp.getDataType().getDescriptor().getId() : null) .addValue("dataTypeConfig", validationStamp.getDataType() != null ? writeJson(validationStamp.getDataType().getConfig()) : null) ); }