Autofilling required attributes with default/fixed value when marshalling

I'm wondering if there is a way to configure JAXB to set default or fixed values on undefined element attributes when marshalling. For example, if an element is derived from the following schema snippet
<xs:complexType name="CentimetersLength">
      <xs:simpleContent>
         <xs:extension base="xs:double">
            <xs:attribute name="units" fixed="cm" use="required"/>
         </xs:extension>
      </xs:simpleContent>
   </xs:complexType>then when marshalling, I would think it would be acceptable to do the following
CentimetersLength length = new CentimetersLength();
length.setValue(3.0);
marshaller.marshall(length);If the marshaller is set with the schema, it fails because the "units" attribute is required, even though it has a fixed value. If one looks at the JAXB-generated code produced by xjc, CentimetersLength has a method, getUnits(), that returns "cm" by default, but this doesn't carry over to the marshalled XML document.
Thanks for the help,
Josh

Check this if it helps you?

Similar Messages

  • JAXB XML doesn't build default/fixed values?

    Hi people.
    I need to build a status XML that must look like this:
    <rule name="TeamPayment" result="Auditing">
       <code>968</code>
       <code>571</code>
    </rule>I'm using JAXB 2, there is a attribute named 'result' with a fixed value that the marshaller doesn't adds to the XML.
    I'm not setting the value of attribute 'result' in my code, because it has a fixed value and I think the marshaller must obey the Schema definition.
    Also, I set the Schema to the marshaller. marsh.setSchema(ruleSchema); This is the Schema:
    <xsd:complexType name="RuleInstance" abstract="true">
       <xsd:sequence>
          <xsd:element name="errorCode" type="xsd:string" minOccurs="0"
                maxOccurs="unbounded"/>
          <xsd:element name="scriptText" type="xsd:string" minOccurs="0"
                maxOccurs="1"/>
       </xsd:sequence>
       <xsd:attribute name="name" type="xsd:string" use="required"/>
    </xsd:complexType>
    <xsd:complexType name="AuditingRuleInstance">
       <xsd:complexContent>
          <xsd:extension base="tns:RuleInstance">
             <xsd:attribute name="result" type="xsd:string" fixed="Auditing"/>
          </xsd:extension>
       </xsd:complexContent>
    </xsd:complexType>
    <xsd:complexType name="ApprovedRuleInstance">
       <xsd:complexContent>
          <xsd:extension base="tns:RuleInstance">
             <xsd:attribute name="result" type="xsd:string" fixed="Approved"/>
          </xsd:extension>
       </xsd:complexContent>
    </xsd:complexType>
    <xsd:complexType name="DeniedRuleInstance">
       <xsd:complexContent>
          <xsd:extension base="tns:RuleInstance">
             <xsd:attribute name="result" type="xsd:string" fixed="Denied"/>
          </xsd:extension>
       </xsd:complexContent>
    </xsd:complexType>
    <xsd:complexType name="IgnoredRuleInstance">
       <xsd:complexContent>
          <xsd:extension base="tns:RuleInstance">
             <xsd:attribute name="result" type="xsd:string" fixed="Ignored"/>
          </xsd:extension>
       </xsd:complexContent>
    </xsd:complexType>
    <xsd:complexType name="DeferredRuleInstance">
       <xsd:complexContent>
          <xsd:extension base="tns:RuleInstance">
             <xsd:attribute name="result" type="xsd:string" fixed="Deferred"/>
          </xsd:extension>
       </xsd:complexContent>
    </xsd:complexType>
    <xsd:element name="rule" type="tns:RuleInstance"/>Am I doing something wrong?
    Att,
    TJ.

    I'm not so good at cmake, but I believe that you'll need to explicitely set OpenCV_ROOT_DIR in the PKGBUILD. /usr is defined in cmake/modules/FindOpenCV.cmake, but cmake seems to be missing it.

  • Issue : OBIEE applying default prompt values when pressing return button

    Hi All,
    On my dashboard, I am showing a summary report. This summary report has a link to detail report. I have provided a link for detail report just below the summary report on dashboard. Following is the issue which I am facing
    [1] I run the dashboard for a particular prompt value on the dashboard. Let's say a date value = '1/1/2010'.
    (There is no default value for the prompt).
    [2] Now my summary report is updated according to the prompt value which I selected.
    [3] I click on any value on summary reports and it drill down and recalculated the metrics
    [4] Now when I click on the detail report, i get the detail report too ( in a new window). The issue starts from here.
    [5] When I click on return link from the detail report page, it takes me back to the summary report page ( I land on the report which I got from step 3)
    [6] I click on the return button under the summary report (rememeber I had drilled down) to see the report which i get in step 2
    But, when I click on the return button under the summary report, it changes the prompt value too and applies the default value to the prompt and provides me the initial summary report with default promt value. The report which I got in step 2
    Whereas what i want is when I click on the return link then I should get the report which I got in step 3.
    Why does OBIEE applies the default value when I try to return back to my original summary report. Is this an OBIEE feature or I have some setting issue ?
    Hope I have been able to explain the scenario!
    Can anyone please reply on this. Any help would be much appreciated.
    Thanks,
    Ronny

    hey kart,
    the issue is not about going back to the summary report ...the issue is when i click on the return link below the summary report after returning from the detail report ( which opens in a new window) then it takes me to the initial summary report ( which was loaded by default when the dashboard was loaded) with all the default prompt filters whereas my requirement is to go back to the summary report with the filters which users selected from the prompt ....
    Please let me know.
    Thanks,
    Ronny

  • Object would have more then one attribute with the tag :VALUE

    I'm creating a new component in Ultiboard - a 100 pin connector.  This connector (Hirose) has 4 rows of 25 pins. Alternate rows are staggered. I'm trying to name each pin with it's appropiate name: A1, A2, A3 ....A50. Then B1, B2, B3 .....B50.
    When I change the VALUE or NUMBER attribute, I get the DRC error  message:
    This action cannot be completed because the resulting Object would have more then one attribute with the tag :VALUE
    Please remove one of the attributes and try again.
    Okay, so I've tried deleting the tag and now I can't name the pin at all. 
    What am I missing?

    You should be in the footprint editor to edit the pin name.  Select tools>>Database>>Database Manager, highlight the component in your database and click on the Edit icon.  In the footprint editor, double click on the pad and a SMT or THT pin Properties dialog appears, select the Attributes tab and highlight the Number row, press the change button and you should be able to change the pin name.   
    Tien P.
    National Instruments

  • How to manage with the required attribute with the h:selectOneMenu ?

    dear all,
    I have form with some drop down list.
    All have a default value to invite user to select a criteria.
    By submitting my form I have an actionListener method wich check validity of the fields.
    I would like to display a message near the <h:selectOneMenu> to point the attention of the user about selection must be done.
    I try following:
    <h:selectOneMenu  id="idContractNature" required="#{applicationController.requiredContract}" partialSubmit="true" valueChangeListener="#{applicationController.valueChangeContractType}" value="#{applicationBackingInfo.opportunityInfo.contractNatureId}">                          
                   <f:selectItems    id="SlctContractNatureItms" value="#{applicationDefaultDataController.contractNatures}"/>          
    </h:selectOneMenu>
    <h:message for="idContractNature"></h:message>I set the required attribute to true in the actionListener method if the contract id is equal to 0 (my default value)
    But it doesn't work.
    How can i check the validity of the drop down list?
    I set the required attribute to true when the

    thanks but can set null for the value of the default value due to:
    Can't set property 'contractNatureId' of type 'int' on class '....' to value 'null'.
    because it's a list SelectItem with int / string

  • F:selectItems with default boolean value

    Hi!
    I have problem with using tag f:selectItems. I wrote converter in order to connect my items from the ManyChecbox list directly with my objects instead of strings. Now i would like to connect boolean values with my backing bean, so that when the page is rendered the default choice is marked. How can i do this?
    <h:selectManyCheckbox value="#{myBean.selectedItems}"  converter="MyConverter" >
                               <f:selectItems value="#{myBean.allItems}"/>
    </h:selectManyCheckbox>

    well the component is linked to your backing bean property 'myBean.selectedItems', which is probably a list or something. Whatever value in this list is true will be checked, so make the 'default' one true when you initially create the list (for example, in a @PostConstruct annotated method).

  • Copy table structure with default column values

    Hi....
    I created a table by copying another table structure by using below query.....
    SQL> CREATE TABLE SAMPLE_TEMP AS SELECT * FROM SAMPLE WHERE 1=2;
    But my problem is " the default column values are not copied to new table"
    Suggest a query like that it should " copy a table structure and default values on columns "
    Thanks in advance

    hi,
    One more option would be "dbms_redefinition' - it would work as per your requirement.
    refer further to documentation : http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14258/d_redefi.htm
    - Pavan Kumar N

  • Fk01 - Defaulting Fixed values in Authorisation field

    Hi
    While creating a vendor master via the t code Fk01 , we want to defualt fixed value in the authorisation field (LFA1-BEGRU)for each of the company code.
    I tried through the SHD0 transaction, but it populates only that particular value all the time in the authorisation field.
    can we do it thorugh variant groups.
    Thanks in advance
    kind regards
    sap student

    Hi partha,
    check the domain is active.
    regards
    shibu

  • What do I need to do to default some values when a new row is created in a tabular form?

    Hello all -
    I have a tabular form which requires a few columns to be entered by the user when s/he creates a new row, but other fields in the column can just default to certain values.  How do I set those default values so that the user doesn't have to be bothered with entering any data except those that MUST be entered?
    An example:
    Form1
    REGION        COUNTRY       CITY
    APAC            JAPAN            TOKYO
    APAC            AUSTRALIA    SIDNEY
    APAC            KOREA           SEOUL
    REGION is nearly always APAC, so I want to default to that.  The user can still adjust it if necessary, but I want to set it for the user, just to save having to enter a value.  When the user clicks the the Add Row button, I want to load that value right away and leave the next two fields blank so the user can enter whatever they want.
    Thanks!
    John

    Hi,
    Go edit that column.
    Under Tabular Form Attributes you can find options to set default value
    Regards,
    Jari

  • Custom UME attribute with pre-defined values

    All,
    Is it possible to define a custom UME attribute which will have pre-defined values so that it appears as dropdown select when the admin creates a user?
    Your help is appreciated.
    Thanks

    Hi Aakash,
    I am not a software developer so I cannot really give you details. I can point you to our documentation: [SAP NetWeaver Developer's Guide|http://help.sap.com/saphelp_nw70ehp1/helpdata/en/8b/0b674240449c60e10000000a1550b0/frameset.htm]
    This guide should point you in the right direction. The UME has a public API with which you access the attributes in question programmatically. What you do from there depends what you as a programmer want to do.
    -Michael

  • How to get default input values when using promt user for input

    I use "promt user for input" to input some values. The messageboard appears with blank boxes then I will input  new values. I want to make some default values in this blank boxes so that I needn't to enter new values. Is it possible ?

    Right click on he Express Vi terminal and choose open Front panel to convert it into a standard vi. Then open it. Enter a default value for each control, then right-click on the controls and go to data operation > make current value default.
    Message Edité par chilly charly le 11-18-2007 12:52 PM
    Chilly Charly    (aka CC)
             E-List Master - Kudos glutton - Press the yellow button on the left...        

  • Security Attributes with Multiple/NULL values

    I have a couple of situations where I can't seem to get the authorization component working as I need it to work for a database source.
    1) In the first case, I have two attributes set for "grant security attributes" in the data source, one of which has a single attribute value, and the other which has multiple values, e.g.
    I want to set "grant security attributes" to something like "client_id role_id" where for my dataset, client_id will always be a single numeric value, but I might have multiple role_ids that can view this record. How do I specify in my data source query those multiple attribute values? I tried separating them with spaces, e.g.
    SELECT ...
    'A B' role_id
    FROM
    where "A" and "B" represent unique values (looking to match A OR B). I also tried delimiting them with commas, but neither spaces nor commas seems to work consistently.
    On the authorization end, using oracle.search.plugin.security.auth.db.DBAuthManager as the authorization plug-in, I have the authorization query set as
    SELECT client_id, security_lvl as role_id from test_user_id where user_id = ?
    Each user may have more than one role, so in the above query, security_lvl could be something like "B C"; I'm assuming from the documentation that the delimiter for attribute values in this case should be a space.
    The crawler logs make it appear that everything is getting indexed, so I suspect the issue is on the authorization front.
    2) In the second case, one of my security attributes for the data source may be NULL, meaning that there's no particular authorization restriction on a particular record, so to use the same example as in #1,
    role_id might be NULL for some records, in which case, I want those records returned in the search if the client_id matches, but I can't get the records with the NULL role_id to be returned at all. Again, the crawler logs indicate that everything is being indexed, and I'm not sure if there's a log where I can further troubleshooting authorization issues.
    Any guidance would be appreciated.
    Thanks

    1) The security attributes are OR'd together so if the user has any ONE of the attributes (either client ID or role ID), the document can be seen by the user. What I would try is to create a view to call rather than directly against the table. The view can then leverage a PL/SQL function and encapsulate the logic behind the security tokens to return.
    So the view would look like this...
    CREATE OR REPLACE VIEW USER_SECURITY_V AS
    SELECT
    USER_T.ID,
    MY_SECURITY_FUNCTION(USER_T.ID) AS AUTH_ID
    FROM
    USER_T
    The PL/SQL function would look something like this...
    CREATE OR REPLACE FUNCTION MY_SECURITY_FUNCTION(USER_ID NUMBER) RETURN VARCHAR2 IS
    -- Do whatever you need to do to build a single space-deliminted list of tokens for both Client and Role ID "CLIENTID4 ROLEID5 ROLEID9" then return
    END;
    The data source authorization query then would look like this...
    SELECT AUTH_ID FROM USER_SECURITY_V A WHERE A.ID = ?
    Using a PL/SQL Function to control the tokens gives you the flexibility of modifying security without having to touch the data source directly
    2) I don't quite follow. If any ONE of the tokens match, the document is returned. If the role ID is null, you might try stamping each document a "master" security token indicating it's open to everyone such as "ALL". Then in the PL/SQL Function, return "ALL" in front of the actual values.
    The crawler logs will only tell you what is indexed at crawl time, not how searching is actually working. Try checking the server logs. These should be under something like oracle/ses/seshome/search/base_domain/servers/AdminServer/logs
    Hope this helps!

  • Update other items with the same value when when column contains Y

    CREATE TABLE TEST
       (     "QUATINTY" NUMBER(17,2),
         "AMOUNT" NUMBER(17,2),
         "ERRORRED" VARCHAR2(16 BYTE),
         "PO" VARCHAR2(12 BYTE),
         "LINE" VARCHAR2(10 BYTE),
         "SEQ" VARCHAR2(14 BYTE),
         "INVOICE" VARCHAR2(16 BYTE)
    Insert into TEST (PO,QUATINTY,AMOUNT,ERRORRED,LINE,SEQ,INVOICE) values ('123',5,50,'Y','1','1','inv1');
    Insert into TEST (PO,QUATINTY,AMOUNT,ERRORRED,LINE,SEQ,INVOICE) values ('123',5,50,null,'1','2','inv1');
    Insert into TEST (PO,QUATINTY,AMOUNT,ERRORRED,LINE,SEQ,INVOICE) values ('125',5,50,null,'1','1','inv2');
    Insert into TEST (PO,QUATINTY,AMOUNT,ERRORRED,LINE,SEQ,INVOICE) values ('125',4,50,null,'1','2','inv2');If you notice by the table above what im trying to acomplish is update the errorred column with 'Y' if any of the po and invoice are the same and have a 'Y' on the errored column.
    in other words, i should end up with 'Y' in the errorred column for INV1.
    Can someone point me in the right direction i cant for the life of me figuered this one out.

    Hi,
    Here's one way:
    UPDATE     test
    SET     errorred     = 'Y'
    WHERE     NVL (errorred, 'N') != 'Y'
    AND     (po, invoice)          IN (
                              SELECT  po, invoice
                         FROM      test
                         WHERE      errorred  = 'Y'
    ;This assumes that po and invoice are not NULL. If either column can be NULL, then the solution might be a little messier, depending on the results you want, but only a little. Post some sample data (with NULLs) that shows what kinds of situations you need to handle, and the results from that sample data.

  • Excluding a fixed value with variable defined

    Hi
    In Bex report , a variable is defined already.
    Now the requirement is to exclude (FIXED VALUE) i.e batch with value #.
    if using the restrict option of this charactersitic, i am not able to select both fixed value(which is to be excluded)  and the variable (already defined) simultaneously.
    Message is coming as variable is complex...so cannot select both FIXED VALUE and FIXED VALUE)
    Please suggest a solution
    Regards
    DJ
    Message was edited by:
            Vidyut Kichambare

    Vidyut,
    It seems to work fine for me - select the variable you want and also the fixed value you want to exclude and it should work fine.
    select the variable and then go to the fixed values tab and select the value you want to exclude and select it and do an exclude on the same - ideally when you select a value using a variable - the # would get automatically excluded - not sure why you want to exclude # along with the variable.
    Arun
    Assign points if useful

  • Travel Expense with fixed value

    Hi SAP Gurus!
    Anyone can suggest me how to create a Travel Expense with a fixed value?
    F.e. I want to create a Travel Expense called "Lunch Reimbursement" that is always 5.20€.
    Thank you very much, bye!
    Stefano

    Stupid question, find it!
    Thank you.
    Stefano

Maybe you are looking for