1. 01 Sep, 2017 2 commits
    • Sylvain Thénault's avatar
      [profile gen] Ensure same name children are ordered accorded to their cardinality · 4941eab6a289
      Sylvain Thénault authored
      As explained in the previous commit, we want items with cardinality = 1 first
      then the one with cardinality != 1 if any. See previous commit for detailed
      explanation.
      
      Closes #17098404
      4941eab6a289
    • Sylvain Thénault's avatar
      [hooks] Ensure we don't have several children with cardinality != 1 · 39d1d971e058
      Sylvain Thénault authored
      By trying to validate several profiles using Jing (in Asalae), it appears that
      it isn't possible to validate a profile where there are several elements with
      the same name with optional or/and multiple cardinality, e.g. with a profile
      telling we expect  1..n Document followed by 1 Document, a transfer with two
      documents won't be accepted, telling a required document is missing. This is
      much probably because the validator "eats" the two documents for the first rule,
      then it misses one to satisfy the second rule.
      
      In order to avoid generating such insatisfyable profiles, while not changing
      much the UI for now, we decided to add hook preventing usage of several sibling
      children with a cardinality != 1 during edition, and then at RNG profile
      generation time to put the one with cardinality != 1 as last children. That way
      profiles should always be validable.
      
      This patch introduces the hooks preventing insatisfyable profiles to be created.
      The next one will ensure the order of RNG export.
      
      Two hooks are added to check for unhandled case one for new watched relations
      and the other for update cardinalities.
      
      Added test cases for the 3 most prominent cases: archive unit, document and
      keywords, with more coverage in the first one and only simple check for the two
      others. Also, some test have to be updated to follow this change. Notice diff of
      exported RNG isn't nice to read but is actually only removal of a surrounding
      "oneOrMore" element.
      
      Related to #17098404
      39d1d971e058
  2. 31 Aug, 2017 1 commit
    • Sylvain Thénault's avatar
      [schema] Use 1 as default cardinality for seda elements · a88e6cc83189
      Sylvain Thénault authored
      This has several advantages:
      * it's consistent with xsd/rng defaults
      * it simplifies code
      * it may avoid undesired validation error once #17098404 will be fixed
      
      This requires several test update, fixed by a mix of test case update or
      expected data update to minimize the changes.
      
      Related to #17098404
      a88e6cc83189
  3. 29 Aug, 2017 1 commit
    • Sylvain Thénault's avatar
      [profile gen] Ensure data-objects are exported before sub-units in SEDA 0.2 · 68c5f87f8677
      Sylvain Thénault authored
      else this won't be conform to the SEDA 0.2schema. But notice this is the
      opposite in SEDA 1.0. In this case, test cases were fine but the problem was
      actually the same: data-objects and sub-units order was random, and it's not
      anymore.
      
      As we are here, add eid so we get a total ordering, which is an expected
      property so that exported profiles are consistent during time. This should be
      enough until we want to control ordering from the UI.
      
      Closes extranet #33070904
      68c5f87f8677
  4. 24 Aug, 2017 3 commits
  5. 01 Jun, 2017 1 commit
  6. 18 May, 2017 1 commit
  7. 11 Apr, 2017 1 commit
  8. 31 Mar, 2017 1 commit
  9. 30 Mar, 2017 4 commits
    • Sylvain Thénault's avatar
      [schema] Make description level mandatory · 746ad8fb9838
      Sylvain Thénault authored
      This is an enum in the original xsd while we don't output possible values
      currently, so in the mean time make it mandatory, it's still a bit better than
      relying on the original schema for that, and it makes sense from a business POV
      to force specification of description level of an archive unit.
      
      A lot of tests have to be updated, some of them because output value is now
      different, others because we've to introduce a scheme+concept to handle the
      validation, but they were not expecting that.
      
      Closes #16687907
      746ad8fb9838
    • Sylvain Thénault's avatar
      [profile gen] Export URL for keyword reference content · 3da29cc2d6c8
      Sylvain Thénault authored
      not text. Consistently with SEDA 1/0.2 export.
      3da29cc2d6c8
    • Sylvain Thénault's avatar
      [profile scheme] Use the cwuri_url static method to generate URLs for SEDA 2 export · dd0fa3ba2760
      Sylvain Thénault authored
      as this was already done for SEDA 1/0.2 export.
      
      Move method from SEDA 1 export to the common base class with SEDA 2 export to
      make it available there and avoid duplication. Also SEDA 2 test needs update
      since this method return cwuri instead of absolute_url.
      
      Related to extranet #15934739
      dd0fa3ba2760
    • Sylvain Thénault's avatar
      [profile gen] Be more resilient about supported concept's languages · 455ce14bb7bf
      Sylvain Thénault authored
      Export used to chose concept value by searching for label with the following
      language code:
      
      1. version specific (seda-2, seda-1 or seda-02)
      2. seda
      3. en
      
      and crash if no matching label was found. But it seems we don't want it to crash
      because we use some concept which has e.g. only a concept in 'fr' language code.
      At some point we may want to improve this, depending on the relation (internal
      seda vocabulary vs open vocabulary such as keyword reference), but for now,
      let's add 'fr' to the expected language list and fallback to any language if
      none has been found so the export doesn't fail.
      
      Related to extranet #15934212
      455ce14bb7bf
  10. 29 Mar, 2017 3 commits
    • Sylvain Thénault's avatar
      [cleanup] Fix variable name · 25a08a735334
      Sylvain Thénault authored
      25a08a735334
    • Sylvain Thénault's avatar
      [profile gen] Stop fixing order of binary/physical data objects · 370716d04b28
      Sylvain Thénault authored
      Before this cset, data objects were inserted one after another in some random
      order, but in the RNG semantics this was forcing their order. To avoid this,
      we've to put them in a rng:group node.
      
      Several strategies have been considered to achieve this:
      
      * change the underlying XSD representation, but this would require either
        changing the data model or handling a difference between the representation
        used to generate the schema and the one used to generate the RNG profile,
      
      * add some special case when a data object node is generated, but this would
        require handling some state to see if the rng:group has already been inserted,
      
      * add a postprocessing step doing the job all at once using lxml's API.
      
      It appeared to me that the two first strategies where too much tricky and less
      readable than the third one.
      
      Related to #17066567
      370716d04b28
    • Sylvain Thénault's avatar
      [profile gen] Drop support for SEDA 2.0 XSD export · 377976b673e0
      Sylvain Thénault authored
      XSD isn't able to properly export SEDA 2.0, stop supporting it all together.
      377976b673e0
  11. 09 Mar, 2017 2 commits
  12. 03 Mar, 2017 4 commits
  13. 23 Feb, 2017 1 commit
  14. 20 Jan, 2017 3 commits
    • Sylvain Thénault's avatar
      Set default cardinality of keyword reference to 1 · f54a06d45f49
      Sylvain Thénault authored
      Now that we have a different ui for simple vs reference keyword, cardinality on
      keyword reference is no more meaningful and hidden in the UI, since we would
      like to always have cardinality=1 for reference keyword when generating profiles.
      
      The easiest way to do so is to set proper default value, else by removing the
      attribute we would have to do extra customization to the SEDA 2 profile
      generator to consider that it shouldn't use the cardinality in the SEDA 2 XSD
      (0..1).
      
      Closes #16070921
      f54a06d45f49
    • Sylvain Thénault's avatar
      [xsd2yams] Skip KeywordContent · 4286fd72c879
      Sylvain Thénault authored
      This is a mandatory and unique children of Keyword, so it may be skipped while
      this ease thing to get a different UI for 'simple keyword' vs 'concept keyword'
      that still has to be done.
      
      Related to #16070921
      4286fd72c879
    • Sylvain Thénault's avatar
      [test] Follow new eac cube API · 7f773346c679
      Sylvain Thénault authored
      7f773346c679
  15. 11 Jan, 2017 4 commits
    • Sylvain Thénault's avatar
      [profile gen] Add a special case for path through data_object_reference_id · 5f607c9702cb
      Sylvain Thénault authored
      This relation is explicitly marked as composite in shema/__init__.py to ease the
      case of simplified profiles, where we want data objects to appear as children of
      archive unit instead of references as expected by SEDA 2. Doing this, we
      introduced a bug in SEDA 2 profile generation where the target value (hence the
      referenced data object) was also considered as the 'cardinality entity' (the one
      defining the cardinality / annotation) for the associated XML element. This led
      to using the data object's cardinality / annotation for the *reference* element.
      5f607c9702cb
    • Sylvain Thénault's avatar
      Stop relying on a hook to create SEDATitle if necessary · 5c4708aac9cb
      Sylvain Thénault authored
      This is not anymore necessary for the web UI which may now inline this into the
      archive unit creation form.
      5c4708aac9cb
    • Sylvain Thénault's avatar
      Skip intermediary SEDAContent entity · fff66bc4fa29
      Sylvain Thénault authored
      In SEDA 2.1, only one Content node is permitted per archive unit (2.0 allow
      multiple ones). This allows to skip the SEDAContent entity in our model and to
      attach all its children to its parent
      (SEDASeqAltArchiveUnitArchiveUnitRefIdManagement).
      
      This patch replaces occurences of SEDAContent/seda_content and should have test
      to green but there is still some work to do on the UI side.
      
      Related to #16684017
      fff66bc4fa29
    • Sylvain Thénault's avatar
      Use first line of annotation as title for archive units and data objects · aac19cc4a92e
      Sylvain Thénault authored
      * make it mandatory ;
      
      * update migration script removing id to copy existing value to annotation
        before removal ;
      
      * regenerate test data file since this change adds exported annotations.
      
      Along the way, add missing escaping when displaying user_annotation, by using
      printable_value.
      
      Related to #16070476
      aac19cc4a92e
  16. 10 Jan, 2017 1 commit
    • Sylvain Thénault's avatar
      Stop using unique identifier on archive unit and data objects · 5fb5bf38f962
      Sylvain Thénault authored
      They have been introduced at a first glance to handle references during profile
      generation as well as display of 'first class' element in the UI. The main problem is
      that they clash when using the 'import archive unit' feature, since one may not
      import the same unit twice without changing the id first. Another problem is
      that their purpose is not clear to end-user.
      
      This changeset remove the attribute, use eid instead during profile generation
      and fix tests. UI and proper migration will be handled in later csets.
      
      Related #16070476
      5fb5bf38f962
  17. 05 Jan, 2017 2 commits
    • Sylvain Thénault's avatar
      [profile gen] Fix path_target_values wrt skipped attributes · 6a2991d3a896
      Sylvain Thénault authored
      for instance in case of restrictionEndDate, it was returning
      
        [(content entity, restriction end date entity)]
      
      instead of
      
        [(restriction end date entity, None)]
      
      
      This was only causing cardinality error (eg you get the content entity's
      cardinality instead of the restriction end date's one) which have been unnoticed
      until a cardinality uncompatible with attribute was used on a content node.
      
      Closes #16688086
      6a2991d3a896
    • Sylvain Thénault's avatar
      [profile gen] Use xsd:NCName instead of xsd:IDREF in Relax NG export · c0d56eed71cd
      Sylvain Thénault authored
      because the later may only be used inside an attribute in Relax NG, while in
      SEDA we want to use it as tag content.
      
      This should not be problem if the profile is also checked against the SEDA 2
      XSD.
      
      Closes #16687696
      c0d56eed71cd
  18. 06 Jan, 2017 1 commit
  19. 11 Jan, 2017 1 commit
  20. 05 Jan, 2017 1 commit
  21. 04 Jan, 2017 2 commits