List of usage examples for com.itextpdf.text Chapter setTitle
public void setTitle(final Paragraph title)
From source file:com.athena.chameleon.engine.utils.PDFWriterUtil.java
License:Apache License
/** * Chapter ?// ww w . j av a 2s . c o m * * @param text Chapter title * @param chapterNo Chapter Number * @return Chapter */ public static Chapter getChapter(String text, int chapterNo) { Chapter chapter = new Chapter(text, chapterNo); String title = chapter.getTitle().getContent(); Chunk c = new Chunk(text, fnChapter); c.setLocalDestination(title); Paragraph chapterPh = new Paragraph(); chapterPh.add(c); chapterPh.setSpacingAfter(12); chapter.setTitle(chapterPh); return chapter; }
From source file:eu.aniketos.wp1.ststool.report.pdfgenerator.ReportContentFactory.java
License:Open Source License
private void buildIntorductionChapter(Chapter chapter) { chapter.setTitle(getChapterTitleParagraph("Introduction")); chapter.setTriggerNewPage(true);/*from w w w . j a v a 2 s .c om*/ StringBuilder sb = new StringBuilder(); sb.append("This document describes the security requirements for the " + getProjectName() + " project. It provides a detailed description of the socio-technical security requirements models "); if (generateSecurityRequirementsChapter() && (!generateSocialViewChapter() && !generateInformationViewChapter() && !generateAuthorisationViewChapter())) { sb.append("presenting the list of security requirements derived in terms of social commitments."); } else { List<String> views = new ArrayList<String>(); if (generateSocialViewChapter()) { views.add("%iSocial%"); } if (generateInformationViewChapter()) { views.add("%iInformation%"); } if (generateAuthorisationViewChapter()) { views.add("%iAuthorisation%"); } if (views.size() == 1) { sb.append("from a view "); } else { sb.append("from different views "); } sb.append("(" + separateListOfString(views, ", ", ", ") + ")"); if (generateSecurityRequirementsChapter()) { sb.append(" and then presents the list of %isecurity requirements% derived from them"); } sb.append("."); } chapter.add(createParagraph(sb.toString())); sb = new StringBuilder(); if (generateSocialViewChapter()) { sb.append( "The %iSocial view% represents stakeholders as intentional and social entities, representing their goals and important information in terms of documents, together with their interactions with other actors to achieve these goals and to exchange information. Stakeholders express constraints over their interactions in terms of %i security needs. % "); } if (generateInformationViewChapter()) { if (sb.length() > 0) sb.append(" "); sb.append( "The %iInformation view% represents the informational content of stakeholders documents, showing how information and documents are interconnected, as well as how they are composed respectively."); } if (generateAuthorisationViewChapter()) { if (sb.length() > 0) sb.append(" "); sb.append( "The %iAuthorisation view% represents which stakeholders own what information, and captures the flow of permissions from one stakeholder to another. The modelling of authorisations expresses other %i security needs % related to the way information is to be manipulated. "); } if (sb.length() > 0) chapter.add(createParagraph(sb.toString())); if (generateSecurityRequirementsChapter()) { String s = "The document ends with the list of %isecurity requirements% for the system to be expressed in terms of %i social commitments%, namely promises with contractual validity stakeholders make to one another. The security requirements are derived automatically once the modelling is done and the designer has expressed the security needs. Whenever a security need is expressed over an interaction from one stakeholder to the other, a commitment on the opposite direction is expected from the second stakeholder to satisfy the security need."; chapter.add(createParagraph(s)); } chapter.setComplete(true); }
From source file:eu.aniketos.wp1.ststool.report.pdfgenerator.ReportContentFactory.java
License:Open Source License
/******************************************************************************************/ private void buildSocialViewChapter(Chapter chapter, Document document) { chapter.setTitle(getChapterTitleParagraph("Social View")); String chapterIntro = "The social view shows the involved stakeholders, which are represented as %iroles% and %iagents%. Agents refer to actual participants (stakeholders) known when modelling the " + getProjectName()/* w w w . j av a 2 s. co m*/ + " project, whereas roles are a generalisation (abstraction) of agents. To capture the connection between roles and agents, the %i play % relation is used to express the fact that certain agents play certain roles."; chapter.add(createParagraph(chapterIntro)); chapterIntro = "Stakeholders have goals to achieve and they make use of different information to achieve these goals. They interact with one another mainly by %i delegating goals% and %i exchanging information%. Information is represented by means of documents, which actors manipulate to achieve their goals."; chapter.add(createParagraph(chapterIntro)); if (generateSocialViewDiagramSection()) { buildSectionSocialDiagram(chapter.addSection(getSectionTitleParagraph("Social View Diagram")), document); chapter.add(Chunk.NEXTPAGE); } if (generateStakeholdersSection()) { buildSectionStakeholders(chapter.addSection(getSectionTitleParagraph("Stakeholders"))); } if (generateStakeholdersDocumentSection()) { buildSectionStakeholdersDocument( chapter.addSection(getSectionTitleParagraph("Stakeholders' documents"))); } if (generateStakeholdersDocumentAndGoalsSection()) { buildSectionStakeholdersDocumentAndGoals( chapter.addSection(getSectionTitleParagraph("Stakeholders' documents and goals"))); } if (generateGoalAnalysisSection()) { buildSectionGoalAnalysis(chapter.addSection(getSectionTitleParagraph("Goal Analysis"))); } if (generateGoalContributionSection()) { buildSectionGoalContribution(chapter.addSection(getSectionTitleParagraph("Contributions"))); } if (generateStakeholdersInteractionsSection()) { buildSectionStakeholdersInteractions( chapter.addSection(getSectionTitleParagraph("Stakeholders Interactions"))); } if (generateOrganisationalConstraintsSection()) { buildSectionOrganisationalConstraints( chapter.addSection(getSectionTitleParagraph("Organisational Constraints"))); } if (generateEventSection()) { buildEventsSection(chapter.addSection(getSectionTitleParagraph("Events"))); } chapter.setTriggerNewPage(true); chapter.setComplete(true); }
From source file:eu.aniketos.wp1.ststool.report.pdfgenerator.ReportContentFactory.java
License:Open Source License
/******************************************************************************************/ private void buildInformationViewChapter(Chapter chapter, Document document) { chapter.setTitle(getChapterTitleParagraph("Information View")); chapter.setTriggerNewPage(true);/* w w w. j av a 2 s .co m*/ String chapterIntro = "The information view gives a structured representation of the information and documents in the " + getProjectName() + " project. It shows what is the informational content of the documents represented in the social view. Information is represented by one or more documents (%itangible by%), and the same document can make tangible multiple information. Moreover, the information view considers composite documents (information) capturing these by means of %ipart of% relations."; chapter.add(createParagraph(chapterIntro)); if (generateInformationViewDiagramSection()) { buildSectionInformationViewDiagram( chapter.addSection(getSectionTitleParagraph("Information View Diagram")), document); chapter.add(Chunk.NEXTPAGE); } if (generateModellingOwnershipSection()) { buildSectionModellingOwnership(chapter.addSection(getSectionTitleParagraph("Modelling Ownership"))); } if (generateRepresentationInformationSection()) { buildSectionRepresentationInformation( chapter.addSection(getSectionTitleParagraph("Representation of Information"))); } if (generateCompositionSection()) { buildSectionComposition(chapter.addSection(getSectionTitleParagraph("Compositions"))); } chapter.setTriggerNewPage(true); chapter.setComplete(true); }
From source file:eu.aniketos.wp1.ststool.report.pdfgenerator.ReportContentFactory.java
License:Open Source License
/******************************************************************************************/ private void buildAuthorisationViewChapter(Chapter chapter, Document document) { chapter.setTitle(getChapterTitleParagraph("Authorisation View")); String chapterIntro = "The authorisation view shows the permission flow from a stakeholder to another, that is, the authorisations stakeholders grant to others about information, specifying the operations the others can perform over the information. Apart from granting authority on performing operations, a higher authority can be granted, that of further authorising other actors."; chapter.add(createParagraph(chapterIntro)); chapterIntro = "Authorisations start from the information owner. Therefore, in the authorisation view, ownership is preserved and inherited from the information view."; chapter.add(createParagraph(chapterIntro)); if (generateAuthorisationViewDiagramSection()) { buildSectionAuthorisationDiagram( chapter.addSection(getSectionTitleParagraph("Authorisation View Diagram")), document); chapter.add(Chunk.NEXTPAGE);/*from w w w .j av a 2s.c o m*/ } if (generateAuthorisationFlowSection()) { buildSectionAuthorisationFlow(chapter.addSection(getSectionTitleParagraph("Authorisation Flow"))); } chapter.setTriggerNewPage(true); chapter.setComplete(true); }
From source file:eu.aniketos.wp1.ststool.report.pdfgenerator.ReportContentFactory.java
License:Open Source License
/******************************************************************************************/ private void buildSecurityRequirementsChapter(Chapter chapter, Document document) { chapter.setTitle(getChapterTitleParagraph("Security Requirements")); String chapterIntro = "This section provides the list of security requirements derived for the " + getProjectName() + " project."; chapter.add(createParagraph(chapterIntro)); chapterIntro = "The list of security requirements shows the roles/agents that are %iresponsible% to satisfy them, so that stakeholders know what they have to bring about in order to satisfy the corresponding security needs. Security requirements also include the authorisations granted by stakeholders to other stakeholders."; chapter.add(createParagraph(chapterIntro)); chapterIntro = "%iSecurity needs% are expressed mainly over goal delegations, document provisions and authorisations. Therefore, the list of security requirements is derived from every type of security need. Moreover, the organisational constraints specify further %ineeds% over roles and goal, leading to the generation of other security requirements."; chapter.add(createParagraph(chapterIntro)); chapterIntro = "Finally, the %irequester% actors are represented to capture the actors requiring certain security needs to be brought about."; chapter.add(createParagraph(chapterIntro)); buildSecurityRequirementsChapterContent(chapter); chapter.setTriggerNewPage(true);//www.ja v a 2 s.co m chapter.setComplete(true); }
From source file:eu.aniketos.wp1.ststool.report.pdfgenerator.ReportContentFactory.java
License:Open Source License
/******************************************************************************************/ private void buildAnalysisChapter(Chapter chapter, Document document) { chapter.setTitle(getChapterTitleParagraph("Analysis")); String chapterIntro = ""; chapter.add(createParagraph(chapterIntro)); if (generateConsistencyAnalysisSection()) { buildSectionConsistencyAnalysis(chapter.addSection(getSectionTitleParagraph("Consistency Analysis")), document);// ww w .j ava2 s .c o m } if (generateSecurityAnalysisSection()) { buildSectionSecurityAnalysis(chapter.addSection(getSectionTitleParagraph("Security Analysis"))); } if (generateRiskAnalysisSection()) { buildSectionRiskAnalysis(chapter.addSection(getSectionTitleParagraph("Threat Analysis"))); } chapter.setTriggerNewPage(true); chapter.setComplete(true); }
From source file:eu.aniketos.wp1.ststool.report.pdfgenerator.ReportContentFactory.java
License:Open Source License
/******************************************************************************************/ private void buildAppendixAChapter(Chapter c, Document d) { c.setTitle(getChapterTitleParagraph("Appendix A")); c.setNumberDepth(0);//from ww w . ja v a 2s. com c.setTriggerNewPage(true); float width = d.getPageSize().getWidth() - d.leftMargin() - d.rightMargin(); float height = d.getPageSize().getHeight() - d.topMargin() - d.bottomMargin() - 70; if (needSocialDiagramInAppendixA()) { Image socialImage = rsp.generateScrenshot(ViewsManager.SOCIAL_VIEW); socialImage.setAlignment(Element.ALIGN_CENTER); if (socialImage.getPlainWidth() > socialImage.getPlainHeight()) { fitImageInArea(socialImage, height, width, true); socialImage.setRotationDegrees(90); } else { fitImageInArea(socialImage, width, height, true); } c.add(decorateImage(socialImage, ftc.getFigure(FigureConstant.SOCIAL_DIAGRAM) + " - Social View for the " + getProjectName() + " project")); } if (needInformationDiagramInAppendixA()) { Image informationImage = rsp.generateScrenshot(ViewsManager.RESOURCE_VIEW); informationImage.setAlignment(Element.ALIGN_CENTER); if (informationImage.getPlainWidth() > informationImage.getPlainHeight()) { fitImageInArea(informationImage, height, width, true); informationImage.setRotationDegrees(90); } else { fitImageInArea(informationImage, width, height, true); } // c.add(informationImage); c.add(decorateImage(informationImage, ftc.getFigure(FigureConstant.INFORMATION_DIAGRAM) + " - Information View for the " + getProjectName() + " project")); } if (needInformationDiagramInAppendixA()) { Image authorisationImage = rsp.generateScrenshot(ViewsManager.AUTHORIZATION_VIEW); authorisationImage.setAlignment(Element.ALIGN_CENTER); if (authorisationImage.getPlainWidth() > authorisationImage.getPlainHeight()) { fitImageInArea(authorisationImage, height, width, true); authorisationImage.setRotationDegrees(90); } else { fitImageInArea(authorisationImage, width, height, true); } // c.add(authorisationImage); c.add(decorateImage(authorisationImage, ftc.getFigure(FigureConstant.AUTH_DIAGRAM) + " - Authorisation View for the " + getProjectName() + " project")); } c.setComplete(true); }
From source file:eu.aniketos.wp1.ststool.report.pdfgenerator.ReportContentFactory.java
License:Open Source License
private void buildAppendixBChapter(Chapter c, Document d) { c.setTitle(getChapterTitleParagraph("Appendix B")); c.setNumberDepth(0);/* w w w .j a v a 2s . c om*/ c.setTriggerNewPage(true); String sectionIntro = "Details of consistency analysis:"; c.add(createParagraph(sectionIntro)); List<Paragraph> plist = new ArrayList<Paragraph>(); for (String aName : ConsistencyAnalysisTasksNames.ALL_TASKS_NAMES) { plist.add(getConsistencyAnalysisDescription(aName)); } c.add(listParagraphs(plist)); c.setComplete(true); }
From source file:eu.aniketos.wp1.ststool.report.pdfgenerator.ReportContentFactory.java
License:Open Source License
private void buildAppendixCChapter(Chapter c, Document d) { c.setTitle(getChapterTitleParagraph("Appendix C")); c.setNumberDepth(0);/* w ww. ja va2 s . co m*/ c.setTriggerNewPage(true); String sectionIntro = "STS-ml allows for the specification of security needs over actors interactions. It currently supports a non-exhaustive set of security needs and organisational constraints, namely non-repudiation, redundancy, no-delegation, non-usage, non-modification, non-production, non-disclosure and need-to-know. The purpose of security analysis is to verify whether there are any violations of security needs. As such, it includes defining the rules necessary to detect violations. In the following are provided the details for all the checks performed during security analysis."; c.add(createParagraph(sectionIntro)); List<Paragraph> plist = new ArrayList<Paragraph>(); int kk = 0; for (kk = kk; kk < 4; kk++) { plist.add(getSecurityAnalysisDescription(SecurityAnalysisTasksNames.ALL_TASKS_NAMES[kk])); } c.add(listParagraphs(plist)); plist.clear(); Paragraph parList = getDefaultParagraph(); com.itextpdf.text.List list = new com.itextpdf.text.List(com.itextpdf.text.List.UNORDERED); list.setListSymbol("\u2022" + " "); list.setSymbolIndent(30f); parList.add(list); parList.setSpacingBefore(0f); parList.setSpacingAfter(0f); list.add(new ListItem(getSecurityAnalysisDescription(SecurityAnalysisTasksNames.ALL_TASKS_NAMES[kk++]))); com.itextpdf.text.List subList = new com.itextpdf.text.List(com.itextpdf.text.List.UNORDERED); subList.setListSymbol("\u2022" + " "); subList.setSymbolIndent(15f); for (kk = kk; kk < 10; kk++) { subList.add( new ListItem(getSecurityAnalysisDescription(SecurityAnalysisTasksNames.ALL_TASKS_NAMES[kk]))); // plist.add(getSecurityAnalysisDescription(SecurityAnalysisTasksNames.ALL_TASKS_NAMES[kk])); } list.add(subList); c.add(parList); /* * Paragraph actorName = createParagraph(type + "%b" + a.getName() + * "%:"); actorName.setSpacingAfter(5); * * com.itextpdf.text.List list = new * com.itextpdf.text.List(com.itextpdf.text.List.UNORDERED); * list.setListSymbol("\u2022" + " "); list.setSymbolIndent(10f); * list.add(new ListItem(actorName)); * * if (sbOut.length() > 0) { com.itextpdf.text.List sublist = new * com.itextpdf.text.List(com.itextpdf.text.List.UNORDERED); * sublist.setListSymbol("- "); sublist.setSymbolIndent(30f); * //Paragraph p=createParagraph("%b" + a.getName() + "% " + * sbOut.toString() + "."); Paragraph p = * createParagraph(sbOut.toString() + "."); * * if (sbInc.length() > 0) { p.setSpacingAfter(10); } * * sublist.add(new ListItem(p)); list.add(sublist); */ String text = "Apart from the verification of violations of security needs, security analysis performs checks to verify that actors comply with their authorities. For this, it searches for eventual unauthorised passages of rights. For the time being, the following violations are detected:"; c.add(createParagraph(text)); parList = getDefaultParagraph(); list = new com.itextpdf.text.List(com.itextpdf.text.List.UNORDERED); list.setListSymbol("\u2022" + " "); list.setSymbolIndent(30f); parList.add(list); parList.setSpacingBefore(0f); parList.setSpacingAfter(0f); list.add(new ListItem(getSecurityAnalysisDescription(SecurityAnalysisTasksNames.ALL_TASKS_NAMES[kk++]))); subList = new com.itextpdf.text.List(com.itextpdf.text.List.UNORDERED); subList.setListSymbol("\u2022" + " "); subList.setSymbolIndent(15f); for (kk = kk; kk < 16; kk++) { subList.add( new ListItem(getSecurityAnalysisDescription(SecurityAnalysisTasksNames.ALL_TASKS_NAMES[kk]))); // plist.add(getSecurityAnalysisDescription(SecurityAnalysisTasksNames.ALL_TASKS_NAMES[kk])); } list.add(subList); c.add(parList); text = "As far as organisational constraints are concerned, security analysis verifies that the specification of SoD and BoD constraints can be satisfied in the given model. The satisfaction of role-based SoD and BoD are already covered by the consistency analysis, security analysis deals with goal-based SoD and BoD instead."; c.add(createParagraph(text)); for (kk = kk; kk < SecurityAnalysisTasksNames.ALL_TASKS_NAMES.length; kk++) { plist.add(getSecurityAnalysisDescription(SecurityAnalysisTasksNames.ALL_TASKS_NAMES[kk])); } c.add(listParagraphs(plist)); c.setComplete(true); }