Package com.cardence.lawshelf.model

Examples of com.cardence.lawshelf.model.Code


      Section parent = new Section();
      parent.setId(rs.getInt("parent_section_id"));
      section.setParentSectionId(parent.getId());
      section.setParent(parent);

      Code code = new Code();
      code.setId(rs.getInt("code_id"));
      section.setCode(code);
      section.setCodeId(code.getId());

      section.setId(rs.getInt("id"));
      section.setSourceReference(rs.getString("source_reference"));
      section.setSectionSequence(rs.getInt("section_sequence"));
      section.setShortHeading(rs.getString("short_heading"));
View Full Code Here


  private static final String SQL_UPDATE = "update code set heading = ?, short_heading = ?, name = ?, code_sequence = ?, status = ?, code_collection_id = ?, heading_title = ? where id = ?";
  private static final String SQL_CREATE = "insert into code (heading, short_heading, name, code_sequence, status, code_collection_id, heading_title) values (?, ?, ?, ?, ?, ?, ?) ";

  private static final class CodeMapper implements RowMapper<Code> {
    public Code mapRow(ResultSet rs, int rowNum) throws SQLException {
      Code code = new Code();
      code.setHeading(rs.getString("heading"));
      code.setShortHeading(rs.getString("short_heading"));
      code.setName(rs.getString("name"));
      code.setCodeSequence(rs.getInt("code_sequence"));
      code.setStatus(rs.getString("status"));
      code.setCodeCollectionId(rs.getInt("code_collection_id"));
      code.setId(rs.getInt("id"));
      code.setTitle(rs.getString("heading_title"));

      return code;
    }
View Full Code Here

  @Autowired
  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
        .findTopLevelSectionByCode(code.getId());

    for (Section section : topSections) {
      section.setSectionSequence(code.getCodeSequence());
      folders.add(convertSection(section));
    }

    // cabinet.getFolder().add(convertCode(code));
View Full Code Here

  }

  public void convertXmlToMySql(
      final com.cardence.lawshelf.model.xml.Code xmlCode) {

    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

    }

  }

  private Code convertCodeXml(com.cardence.lawshelf.model.xml.Code xmlCode) {
    Code c = new Code();
    c.setTitle(xmlCode.getTitle());
    c.setStatus(xmlCode.getStatus());
    c.setShortHeading(xmlCode.getShortHeading());
    c.setName(xmlCode.getTitle());
    c.setHeading(xmlCode.getHeading());
    if (xmlCode.getSequence() != null) {
      c.setCodeSequence(xmlCode.getSequence().intValue());
    }

    return c;
  }
View Full Code Here

              code.getCodeSequence(), code.getCodeCollectionId());

      if (foundCodes != null && !foundCodes.isEmpty()) {
        // found one... update
        assert foundCodes.size() == 1;
        Code foundCode = (Code) foundCodes.toArray()[0];
        code.setId(foundCode.getId());
        this.codeDao.updateCode(code);
      } else {
        // did not find one... create
        Integer newId = this.codeDao.createCode(code);
        isUpdate = false;
View Full Code Here

    this.isHead = true;
  }

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

    persistence.storeCodeCollection(codeCollection);

    code.setCodeCollection(codeCollection);
    persistence.storeCode(code);

    this.isHead = false;
  }
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
        code.addAttribute(type, value);
      } else if (type.equals("AUTHORITIES-USC-TITLE-NAME")) {
        String[] valueParts = StringUtils.split(value, "-");
        code.setName(valueParts[1].trim());
        code.addAttribute(type, value);
      } else if (type.equals("AUTHORITIES-USC-TITLE-ENUM")) {
        code.setCodeSequence(Integer.parseInt(value));
        code.addAttribute(type, value);
      } else if (type.equals("AUTHORITIES-USC-TITLE-STATUS")) {
        code.setStatus(value);
        code.addAttribute(type, value);
      }
    } else if (this.isBody) {
      Section section = this.model.getSection();

      if (type.equals("documentid")) {
View Full Code Here

          code.getCodeSequence(), code.getCodeCollectionId());

      if (foundCodes != null && !foundCodes.isEmpty()) {
        // found one... update
        assert foundCodes.size() == 1;
        Code foundCode = (Code) foundCodes.toArray()[0];
        code.setId(foundCode.getId());
        this.codeDao.updateCode(code);
      } else {
        // did not find one... create
        Integer newId = this.codeDao.createCode(code);
        isUpdate = false;
View Full Code Here

TOP

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

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.