Let's try that again... It seems that the field value should be set using the shared language, but in the create method it is done using the current language, which is not correct.


Regards,
 Serge Huber.

Serge Huber wrote:


I think this is a bug, it seems that boolean's field value is created using the current language, but the field value is set using a language.


Regards,
 Serge Huber.

Predrag Viceic wrote:

Hi,

I have the problem with automated generation of ContentBooleanField. The code that works perfectly for SmallText:


----------------8<-------------------------8<-----------------------------


ContentSmallTextField threadDescriptionField=ContentSmallTextField.createSmallText(
siteID,
newPage.getID(),
threadDataHolderC.getID(), //container Id
threadDescriptionFieldDefinition.getID(),
newPageField.getPage(jData.params()).getAclID(),
0,
newThreadDescription,
jData.params());


StateModificationContext smc6=new StateModificationContext(
new ContentFieldKey(threadDescriptionField.getID()),
languageCodes,
true);


               threadDescriptionField.activate(languageCodes,
                       0,
                       jData.params(),
                       smc6);

----------------8<-------------------------8<-----------------------------


doesn't work for Boolean:


----------------8<-------------------------8<-----------------------------


ContentBooleanField threadUseValidationField=ContentBooleanField.createBoolean(
siteID,
newPage.getID(),
threadDataHolderC.getID(), //container Id
threadUseValidationFieldDefinition.getID(),
newPageField.getPage(jData.params()).getAclID(),
0,
false,
jData.params());





StateModificationContext smc7=new StateModificationContext(
new ContentFieldKey(threadUseValidationField.getID()),
languageCodes,
true);


               threadUseValidationField.activate(languageCodes,
                       0,
                       jData.params(),
                       smc7);

----------------8<-------------------------8<-----------------------------


In fact, Jahia complains about :

----------------8<-------------------------8<-----------------------------

org.jahia.exceptions.JahiaException:
Entry [ENTRY:workFlowState=2, versionID=0, languageCode=shared] not found for field 59831 using request : [SELECT value_jahia_fields_data FROM jahia_fields_data WHERE id_jahia_fields_data=59831 AND workflow_state>1 AND version_id=0 AND language_code='shared'], Entry [ENTRY:workFlowState=2, versionID=0, languageCode=shared] not found for field 59831


----------------8<-------------------------8<-----------------------------


So, I have checked, and in the dbthe field language_code is "fr". My languageCodes are defined as:


----------------8<-------------------------8<-----------------------------

HashSet languageCodes=new HashSet();
               languageCodes.add("en");
               languageCodes.add("fr");
               languageCodes.add("shared");

----------------8<-------------------------8<-----------------------------


I have compared the code for methods ContentSmallTextField.createSmallText() and ContentBooleanField.createBoolean() and they are identical (ok, equivalent..)..


Any help?

Regards,
Predrag Viceic








Reply via email to