Examples of Section


Examples of a.b.m2.Section

  public void createBeanCreateCloneThenCloneShouldHaveSameStructureAndValuesButEveryElementOfDifferentReference() {
   
    // create some data
    // use a.b.m2.Book which has 1:N relations (collection) to other beans
    Book book = new Book("History of Britain", "John O'Farrel", ImmutableList.copyOf(new Section[] {
      new Section("Section1", "no description", ImmutableSet.copyOf(new Paragraph[] {
          new Paragraph(1, "Bla bla bla"),
          new Paragraph(1, "Bla bla bla"),
      })),
      new Section("Section2", "no description", ImmutableSet.copyOf(new Paragraph[] {
          new Paragraph(1066, "Bla bla bla"),
      })),
      new Section("Section3", "no description", ImmutableSet.copyOf(new Paragraph[] {
          new Paragraph(1, "Bla bla bla"),
          new Paragraph(2, "Bla bla bla"),
          new Paragraph(3, "Bla bla bla"),
      })),
    }));
View Full Code Here

Examples of br.com.caelum.tubaina.Section

        if (sectionTitle != null) {
          sectionTitle = sectionTitle.trim();
        }
        String sectionContent = matcher.group(2);
        if (sectionTitle != null || sectionContent.trim().length() > 0) {
          Section section = new SectionBuilder(sectionTitle, sectionContent, resources).build();
          sections.add(section);
        }
        offset = matcher.end(2);
      }
    }
View Full Code Here

Examples of civquest.parser.ruleset.Section

    messages.info("MapData-Config", "VegConf", "==============================");
    messages.info("MapData-Config", "VegConf", "Loading vegetation definitions");
   
    Iterator<Section> sectionIterator = vegetationRuleset.getSectionIterator();
    while (sectionIterator.hasNext()) {
      Section section = sectionIterator.next();
      String name = section.getField("Name").getStringValue();

      checkVegetationName(name);

      if (vegetationDefinitions.containsKey(name)) {
        // vegetation already defined
View Full Code Here

Examples of com.android.dex.Dex.Section

    this.cls = cls;
    this.dex = cls.dex();
  }

  public void parse(int offset) throws DecodeException {
    Section section = dex.openSection(offset);

    // TODO read as unsigned int
    int classAnnotationsOffset = section.readInt();
    int fieldsCount = section.readInt();
    int annotatedMethodsCount = section.readInt();
    int annotatedParametersCount = section.readInt();

    if (classAnnotationsOffset != 0) {
      cls.addAttr(readAnnotationSet(classAnnotationsOffset));
    }

    for (int i = 0; i < fieldsCount; i++) {
      FieldNode f = cls.searchFieldById(section.readInt());
      f.addAttr(readAnnotationSet(section.readInt()));
    }

    for (int i = 0; i < annotatedMethodsCount; i++) {
      MethodNode m = cls.searchMethodById(section.readInt());
      m.addAttr(readAnnotationSet(section.readInt()));
    }

    for (int i = 0; i < annotatedParametersCount; i++) {
      MethodNode mth = cls.searchMethodById(section.readInt());
      // read annotation ref list
      Section ss = dex.openSection(section.readInt());
      int size = ss.readInt();
      MethodParameters params = new MethodParameters(size);
      for (int j = 0; j < size; j++) {
        params.getParamList().add(readAnnotationSet(ss.readInt()));
      }
      mth.addAttr(params);
    }
  }
View Full Code Here

Examples of com.aspose.words.Section

  public static void main(String[] args) throws Exception
  {
    Document doc = new Document();
      DocumentBuilder builder = new DocumentBuilder(doc);

      Section currentSection = builder.getCurrentSection();
      PageSetup pageSetup = currentSection.getPageSetup();

      // Specify if we want headers/footers of the first page to be different from other pages.
      // You can also use PageSetup.OddAndEvenPagesHeaderFooter property to specify
      // different headers/footers for odd and even pages.
      pageSetup.setDifferentFirstPageHeaderFooter(true);
View Full Code Here

Examples of com.avaje.tests.model.basic.Section

public class TestQueryFindReadOnly extends BaseTestCase {

  @Test
  public void test() {

    Section s0 = new Section("some content");
    Article a0 = new Article("art1", "auth1");
    a0.addSection(s0);

    Ebean.save(a0);

    Article ar1 = Ebean.find(Article.class).setReadOnly(true).setId(a0.getId()).findUnique();

    Assert.assertNotNull(ar1);
    Assert.assertTrue("readonly", Ebean.getBeanState(ar1).isReadOnly());

    List<Section> ar1sections = ar1.getSections();
    Assert.assertEquals(1, ar1sections.size());

    Section s2 = ar1sections.get(0);
    Assert.assertTrue("readonly cascading", Ebean.getBeanState(s2).isReadOnly());

    Ebean.runCacheWarming(Article.class);

    Article ar0 = Ebean.find(Article.class, a0.getId());

    Assert.assertNotNull(ar0);
    Assert.assertFalse(Ebean.getBeanState(ar0).isReadOnly());

    List<Section> ar0sections = ar0.getSections();
    Section s1 = ar0sections.get(0);
    Assert.assertFalse(Ebean.getBeanState(s1).isReadOnly());

  }
View Full Code Here

Examples of com.cardence.lawshelf.model.Section

  private static final String SQL_UPDATE_SECTION = "update section set parent_section_id = ?, code_id = ?, heading = ?, short_heading = ?, source_reference = ?, section_sequence = ?, level_type = ?, level_position = ?, heading_text = ? where id = ?";
  private static final String SQL_CREATE_SECTION = "insert into section (parent_section_id, code_id, heading, short_heading, source_reference, section_sequence, level_type, level_position, heading_text) values (?, ?, ?, ?, ?, ?, ?, ?, ?) ";

  private static final class SectionMapper implements RowMapper<Section> {
    public Section mapRow(ResultSet rs, int rowNum) throws SQLException {
      Section section = new Section();

      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);
View Full Code Here

Examples of com.darkhonor.rage.model.Section

                                            {
                                                SectionDAO sectionDAO = new SectionDAO(emf.createEntityManager());
                                                // TODO: Need to add query for name...but Sections are not equal by name...RAGE-94
                                                query = em.createQuery("select s FROM Section s WHERE s.name = :name");
                                                query.setParameter("name", s.getName());
                                                Section res;
                                                try
                                                {
                                                    res = (Section)query.getSingleResult();
                                                }
                                                catch (NoResultException ex)
                                                {
                                                    // Section not found in DB
                                                    res = null;
                                                }
                                                if (res == null)   // The section is not in the database
                                                {
                                                    tx.begin();
                                                    em.persist(s);
                                                    tx.commit();
                                                    //stu.setSection(s);
                                                }
                                                else
                                                {
                                                    tx.begin();
                                                    em.persist(res);
                                                    tx.commit();
                                                    //stu.setSection(res);
                                                }
                                                // TODO: RAGE-34 - Migrate to StudentDAO
                                                query = em.createQuery("select p FROM Person p WHERE p.webID = :webid");
                                                query.setParameter("webid", stu.getWebID());
                                                Student stuRes;
                                                try
                                                {
                                                    stuRes = (Student)query.getSingleResult();
                                                }
                                                catch (NoResultException ex)
                                                {
                                                    // Student not found in DB
                                                    stuRes = null;
                                                }
                                                if (stuRes == null)   // The student is not in the database
                                                {
                                                    tx.begin();
                                                    em.persist(stu);
                                                    tx.commit();
                                                }
                                                sectionDAO.closeConnection();
                                            }
                                            tx.begin();
                                            // TODO: RAGE-71 - Migrate to InstructorDAO
                                            query = em.createQuery("select p FROM Person p WHERE p.webID = :webid");
                                            query.setParameter("webid", ins.getWebID());
                                            Instructor insRes;
                                            try
                                            {
                                                insRes = (Instructor)query.getSingleResult();
                                            }
                                            catch (NoResultException ex)
                                            {
                                                // Instructor not found in DB
                                                insRes = null;
                                            }
                                            if (insRes == null)   // The instructor is not in the database
                                            {
                                                em.persist(ins);
                                            }
                                            else
                                            {
                                                ins.setId(insRes.getId());
                                            }

                                            query = em.createQuery("select c FROM Course c WHERE name = :name");
                                            query.setParameter("name", c.getName());
                                            Course crsRes;
                                            try
                                            {
                                                crsRes = (Course)query.getSingleResult();
                                            }
                                            catch (NoResultException ex)
                                            {
                                                // Instructor not found in DB
                                                crsRes = null;
                                            }
                                            if (crsRes == null)   // The instructor is not in the database
                                            {
                                                em.persist(c);
                                            }
                                            else
                                            {
                                                c.setId(crsRes.getId());
                                            }

                                            //s.setStudents(students);
                                            s.setInstructor(ins);
                                            s.setCourse(c);
                                            query = em.createQuery("select s FROM Section s WHERE s.name = :name");
                                            query.setParameter("name", s.getName());
                                            Section res;
                                            try
                                            {
                                                res = (Section)query.getSingleResult();
                                            }
                                            catch (NoResultException ex)
                                            {
                                                // Section not found in DB
                                                res = null;
                                            }
                                            if (res == null)   // The section is not in the database
                                            {
                                                em.persist(s);
                                            }
                                            else
                                            {
                                                s.setId(res.getId());
                                            }
                                            tx.commit();
                                        }
                                    }
                                    try
                                    {
                                        ins.setSections(sections);
                                    }
                                    catch (IllegalArgumentException e)
                                    {
                                        System.out.println("ERROR Setting Sections.  Size of Section list: " + sections.size());
                                    }
                                    tx.begin();
                                    query = em.createQuery("select p FROM Person p WHERE p.webID = :webid");
                                    query.setParameter("webid", ins.getWebID());
                                    Instructor res;
                                    try
                                    {
                                        res = (Instructor)query.getSingleResult();
                                    }
                                    catch (NoResultException ex)
                                    {
                                        // Instructor not found in DB
                                        res = null;
                                    }
                                    if (res == null)   // The instructor is not in the database
                                    {
                                        em.persist(ins);
                                    }
                                    else
                                    {
                                        ins.setId(res.getId());
                                    }
                                    tx.commit();
                                }
                            }
                            try
View Full Code Here

Examples of com.google.api.client.util.PemReader.Section

  }

  @Beta
  private static PrivateKey privateKeyFromPkcs8(String privateKeyPem) throws IOException {
    Reader reader = new StringReader(privateKeyPem);
    Section section = PemReader.readFirstSectionAndClose(reader, "PRIVATE KEY");
    if (section == null) {
      throw new IOException("Invalid PKCS8 data.");
    }
    byte[] bytes = section.getBase64DecodedBytes();
    PKCS8EncodedKeySpec keySpec = new PKCS8EncodedKeySpec(bytes);
    Exception unexpectedException = null;
    try {
      KeyFactory keyFactory = SecurityUtils.getRsaKeyFactory();
      PrivateKey privateKey = keyFactory.generatePrivate(keySpec);
View Full Code Here

Examples of com.itextpdf.text.Section

                }
                case Element.SECTION:
                case Element.CHAPTER: {
                    // Chapters and Sections only differ in their constructor
                    // so we cast both to a Section
                    Section section = (Section) element;
                    PdfPageEvent pageEvent = writer.getPageEvent();

                    boolean hasTitle = section.isNotAddedYet()
                      && section.getTitle() != null;

                    // if the section is a chapter, we begin a new page
                    if (section.isTriggerNewPage()) {
                        newPage();
                    }

                    if (hasTitle) {
                      float fith = indentTop() - currentHeight;
                      int rotation = pageSize.getRotation();
                      if (rotation == 90 || rotation == 180)
                        fith = pageSize.getHeight() - fith;
                      PdfDestination destination = new PdfDestination(PdfDestination.FITH, fith);
                      while (currentOutline.level() >= section.getDepth()) {
                        currentOutline = currentOutline.parent();
                      }
                      PdfOutline outline = new PdfOutline(currentOutline, destination, section.getBookmarkTitle(), section.isBookmarkOpen());
                      currentOutline = outline;
                    }

                    // some values are set
                    carriageReturn();
                    indentation.sectionIndentLeft += section.getIndentationLeft();
                    indentation.sectionIndentRight += section.getIndentationRight();

                    if (section.isNotAddedYet() && pageEvent != null)
                        if (element.type() == Element.CHAPTER)
                            pageEvent.onChapter(writer, this, indentTop() - currentHeight, section.getTitle());
                        else
                            pageEvent.onSection(writer, this, indentTop() - currentHeight, section.getDepth(), section.getTitle());

                    // the title of the section (if any has to be printed)
                    if (hasTitle) {
                        isSectionTitle = true;
                        add(section.getTitle());
                        isSectionTitle = false;
                    }
                    indentation.sectionIndentLeft += section.getIndentation();
                    // we process the section
                    element.process(this);
                    flushLines();
                    // some parameters are set back to normal again
                    indentation.sectionIndentLeft -= section.getIndentationLeft() + section.getIndentation();
                    indentation.sectionIndentRight -= section.getIndentationRight();

                    if (section.isComplete() && pageEvent != null)
                        if (element.type() == Element.CHAPTER)
                            pageEvent.onChapterEnd(writer, this, indentTop() - currentHeight);
                        else
                            pageEvent.onSectionEnd(writer, this, indentTop() - currentHeight);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.