public void createBaseWidgetFields(Structure structure) throws DotDataException,DotStateException {
if(!InodeUtils.isSet(structure.getInode())){
throw new DotStateException("Cannot create base widget feilds on a structure that doesn't exist");
}
Field preExecute = new Field(WIDGET_PRE_EXECUTE_FIELD_NAME,Field.FieldType.HIDDEN,Field.DataType.TEXT,structure,false,false,false,4,"", "", "", true, true, true);
preExecute.setFieldContentlet(FieldAPI.ELEMENT_CONSTANT);
Field codeField = new Field(WIDGET_CODE_FIELD_NAME,Field.FieldType.HIDDEN,Field.DataType.TEXT,structure,false,false,false,3,"", "", "", true, true, true);
codeField.setFieldContentlet(FieldAPI.ELEMENT_CONSTANT);
Field usageField = new Field(WIDGET_USAGE_FIELD_NAME,Field.FieldType.TEXT_AREA,Field.DataType.TEXT,structure,false,false,false,2,"", "", "", true, true, true);
usageField.setFieldContentlet(FieldAPI.ELEMENT_CONSTANT);
Field titleField = new Field(WIDGET_TITLE_FIELD_NAME,Field.FieldType.TEXT,Field.DataType.TEXT,structure,true,true,true,1,"", "", "", true, false, true);
FieldFactory.saveField(preExecute);
FieldFactory.saveField(codeField);
FieldFactory.saveField(usageField);
FieldFactory.saveField(titleField);
FieldsCache.clearCache();