Package com.cardence.lawshelf.model

Examples of com.cardence.lawshelf.model.CodeCollection


  private ContentPartDao contentPartDao;

  public Asset convertCodeWithID(Integer id) {

    Code code = codeDao.findCode(id);
    CodeCollection codeCollection = codeCollectionDao
        .findCodeCollection(code.getCodeCollectionId());

    Cabinet cabinet = convertCodeCollection(codeCollection);
    cabinet.setId(id + "-" + codeCollection.getId());

    Asset asset = convertCode(code, cabinet);
    List<Folder> folders = asset.getFolder();

    Collection<Section> topSections = sectionDao
View Full Code Here


    Code mysqlCode = convertCodeXml(xmlCode);

    com.cardence.lawshelf.model.xml.CodeCollection xmlCollection = xmlCode
        .getCodeCollection();

    CodeCollection mysqlCollection = convertCodeCollectionXml(xmlCollection);
    this.storeCodeCollection(mysqlCollection);

    mysqlCode.setCodeCollection(mysqlCollection);
    mysqlCode.setCodeCollectionId(mysqlCollection.getId());

    this.storeCode(mysqlCode);

    List<com.cardence.lawshelf.model.xml.Section> sectionList = xmlCode
        .getSection();
View Full Code Here

    return c;
  }

  private CodeCollection convertCodeCollectionXml(
      com.cardence.lawshelf.model.xml.CodeCollection xmlCollection) {
    CodeCollection cc = new CodeCollection();
    cc.setFederal(xmlCollection.isFederal());
    cc.setStateCode(xmlCollection.getStateCode());
    cc.setHeading(xmlCollection.getHeading());
    cc.setName(xmlCollection.getTitle());
    if (xmlCollection.getYear() != null) {
      cc.setYear(Integer.valueOf(xmlCollection.getYear().intValue()));
    }
    return cc;
  }
View Full Code Here

          .findCodeCollectionsByNameAndYear(codeCollection.getName(),
              codeCollection.getYear());
      if (foundCodeCollections != null && !foundCodeCollections.isEmpty()) {
        // found one... update
        assert foundCodeCollections.size() == 1;
        CodeCollection foundCodeCol = (CodeCollection) foundCodeCollections
            .toArray()[0];
        codeCollection.setId(foundCodeCol.getId());
        this.codeCollectionDao.updateCodeCollection(codeCollection);
      } else {
        // did not find one... create
        Integer newId = this.codeCollectionDao
            .createCodeCollection(codeCollection);
View Full Code Here

  private static final class CodeCollectionMapper implements
      RowMapper<CodeCollection> {
    public CodeCollection mapRow(ResultSet rs, int rowNum)
        throws SQLException {
      CodeCollection series = new CodeCollection();
      series.setName(rs.getString("name"));
      series.setYear(rs.getInt("year"));
      series.setFederal(rs.getBoolean("isFederal"));
      series.setStateCode(rs.getString("statecode"));
      series.setHeading(rs.getString("heading"));
      series.setId(rs.getInt("id"));
      return series;
    }
View Full Code Here

  public void beginHead() {
    this.isHead = true;
  }

  public void endHead() {
    CodeCollection codeCollection = model.getCodeCollection();
    Code code = model.getCode();

    persistence.storeCodeCollection(codeCollection);

    code.setCodeCollection(codeCollection);
View Full Code Here

    String type = StringUtils.trimWhitespace(StringUtils.replace(bothSides[0], "<!--", ""));
    String value = StringUtils.trimWhitespace(StringUtils.replace(bothSides[1], "-->", ""));

    if (this.isHead) {
      CodeCollection codeCollection = model.getCodeCollection();
      Code code = model.getCode();

      if (codeCollection == null) {
        if (isUscPrelim) {
          codeCollection = new UscPrelimCollection()
        } else {
          codeCollection = new UscCollection();
        }
        model.setCodeCollection(codeCollection);
      }
      if (code == null) {
        code = new UscCode();
        model.setCode(code);
      }

      if (type.equals("AUTHORITIES-PUBLICATION-NAME")) {
        code.addAlias(value);
        code.addAttribute(type, value);
      } else if (type.equals("AUTHORITIES-PUBLICATION-ID")) {
        code.addAlias(value);
        code.addAttribute(type, value);
      } else if (type.equals("AUTHORITIES-PUBLICATION-YEAR")) {
        if (!isUscPrelim) {
          codeCollection.setYear(Integer.parseInt(value));
        }
        code.addAttribute(type, value);
      } else if (type.equals("AUTHORITIES-LAWS-ENACTED-THROUGH-DATE")) {
        // ignore... should be caught again on the first documentid
        // element
View Full Code Here

      Collection<CodeCollection> foundCodeCollections = this.codeCollectionDao.findCodeCollectionsByNameAndYear(
          codeCollection.getName(), codeCollection.getYear());
      if (foundCodeCollections != null && !foundCodeCollections.isEmpty()) {
        // found one... update
        assert foundCodeCollections.size() == 1;
        CodeCollection foundCodeCol = (CodeCollection) foundCodeCollections.toArray()[0];
        codeCollection.setId(foundCodeCol.getId());
        this.codeCollectionDao.updateCodeCollection(codeCollection);
      } else {
        // did not find one... create
        Integer newId = this.codeCollectionDao.createCodeCollection(codeCollection);
        isUpdate = false;
View Full Code Here

TOP

Related Classes of com.cardence.lawshelf.model.CodeCollection

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.