List of usage examples for com.itextpdf.text Section setComplete
public void setComplete(final boolean complete)
From source file:eu.aniketos.wp1.ststool.report.pdfgenerator.ReportContentFactory.java
License:Open Source License
private void buildSectionOrganisationalConstraints(Section section) { String sectionIntro = "Apart from the security needs actors specify over their interactions, there are others, which are dictated either by the organisation, business rules and regulations, or law. In this section we enlist these constraints, together with the security requirements derived from them. Currently, the language supports these organisational constraints: %iSeparation of Duties (SoD)% and %iBinding of Duties (BoD)%. Graphically we represent these constraints using a similar notation to that used in workflows, as a circle with the %iunequal% sign within and as a circle with the %iequals% sign within, respectively. The relations are symmetric, and as such they do not have any arrows pointed to the concepts they relate (being these roles or goals)."; section.add(createParagraph(sectionIntro)); List<Actor> selActor = getOrganisationalConstraintsActors(); List<Paragraph> phrases = new ArrayList<Paragraph>(); Map<Role, List<IncompatibleDuties>> incompRole = new HashMap<Role, List<IncompatibleDuties>>(); Map<Goal, List<IncompatibleDuties>> incompGoal = new HashMap<Goal, List<IncompatibleDuties>>(); Map<Role, List<CompatibleDuties>> compRole = new HashMap<Role, List<CompatibleDuties>>(); Map<Goal, List<CompatibleDuties>> compGoal = new HashMap<Goal, List<CompatibleDuties>>(); for (Actor a : selActor) { if (a instanceof Role) { Role r = (Role) a; List<IncompatibleDuties> incDutiesList = new ArrayList<IncompatibleDuties>(); for (IncompatibleDuties id : r.getIncompatibleDutiesOut()) { if (id.getTarget() != null && id.getTarget() instanceof Role) incDutiesList.add(id); }//from ww w .j a v a 2s.c o m for (IncompatibleDuties id : r.getIncompatibleDutiesIn()) { if (id.getSource() != null && id.getSource() instanceof Role) incDutiesList.add(id); } if (incDutiesList.size() > 0) { incompRole.put(r, incDutiesList); } List<CompatibleDuties> compDutiesList = new ArrayList<CompatibleDuties>(); for (CompatibleDuties bd : r.getCompatibleDutiesOut()) { if (bd.getTarget() != null && bd.getTarget() instanceof Role) compDutiesList.add(bd); } for (CompatibleDuties bd : r.getCompatibleDutiesIn()) { if (bd.getSource() != null && bd.getSource() instanceof Role) compDutiesList.add(bd); } if (compDutiesList.size() > 0) { compRole.put(r, compDutiesList); } } for (Goal g : a.getGoals()) { List<IncompatibleDuties> incDutiesList = new ArrayList<IncompatibleDuties>(); for (IncompatibleDuties id : g.getIncompatibleDutiesOut()) { if (id.getTarget() != null && id.getTarget() instanceof Goal) incDutiesList.add(id); } for (IncompatibleDuties id : g.getIncompatibleDutiesIn()) { if (id.getSource() != null && id.getSource() instanceof Goal) incDutiesList.add(id); } if (incDutiesList.size() > 0) { incompGoal.put(g, incDutiesList); } List<CompatibleDuties> compDutiesList = new ArrayList<CompatibleDuties>(); for (CompatibleDuties bd : g.getCompatibleDutiesOut()) { if (bd.getTarget() != null && bd.getTarget() instanceof Goal) compDutiesList.add(bd); } for (CompatibleDuties bd : g.getCompatibleDutiesIn()) { if (bd.getSource() != null && bd.getSource() instanceof Goal) compDutiesList.add(bd); } if (compDutiesList.size() > 0) { compGoal.put(g, compDutiesList); } } } /* * StringBuilder sb = new StringBuilder(); for (Actor a : selActor) { if * (a instanceof Role) { Role r = (Role) a; List<String> incomp = new * ArrayList<String>(); for (IncompatibleDuties id : * r.getIncompatibleDutiesOut()) { if (id.getTarget() != null && * id.getTarget() instanceof Role) incomp.add("%b" + ((Role) * id.getTarget()).getName() + "%"); } for (IncompatibleDuties id : * r.getIncompatibleDutiesIn()) { if (id.getSource() != null && * id.getSource() instanceof Role) incomp.add("%b" + ((Role) * id.getSource()).getName() + "%"); } if (incomp.size() > 0) { String s * = "%b" + r.getName() + "% is incompatible with " + * separateListOfString(incomp) + * ", since %iSoD% constraints are specified between these roles."; if * (sb.length() > 0) sb.append("; "); sb.append("%b" + r.getName() + * "% is incompatible with " + separateListOfString(incomp)); } } } * * if (sb.length() > 0) { * sb.append(", since a %iSoD% constraint is specified between these roles." * ); phrases.add(createParagraph(sb.toString())); } */ for (Role incR : incompRole.keySet()) { List<String> incomp = new ArrayList<String>(); for (IncompatibleDuties id : incompRole.get(incR)) { SeparationOfDuties r = id.getTarget(); if (incR == r) r = id.getSource(); if (r != null && r instanceof Role) incomp.add("%b" + ((Role) r).getName() + "%"); } if (incomp.size() > 0) { String s = "%b" + incR.getName() + "% is incompatible with " + separateListOfString(incomp) + ", since %iSoD% constraints are specified between these roles."; phrases.add(createParagraph(s.toString())); } } for (Role compR : compRole.keySet()) { List<String> comp = new ArrayList<String>(); for (CompatibleDuties cd : compRole.get(compR)) { BindingOfDuties r = cd.getTarget(); if (compR == r) r = cd.getSource(); if (r != null && r instanceof Role) comp.add("%b" + ((Role) r).getName() + "%"); } if (comp.size() > 0) { String s = "%b" + compR.getName() + "% should be combined with " + separateListOfString(comp) + ", since %iBoD% constraints are specified between these roles."; phrases.add(createParagraph(s.toString())); } } for (Goal incG : incompGoal.keySet()) { List<String> incomp = new ArrayList<String>(); for (IncompatibleDuties id : incompGoal.get(incG)) { SeparationOfDuties g = id.getTarget(); if (incG == g) g = id.getSource(); if (g != null && g instanceof Goal) incomp.add("%b" + ((Goal) g).getName() + "%"); } if (incomp.size() > 0) { String s = "%b" + incG.getName() + "% is incompatible with " + separateListOfString(incomp) + ", given that %iSoD% constraint is specified between these goals."; phrases.add(createParagraph(s.toString())); } } for (Goal comG : compGoal.keySet()) { List<String> comp = new ArrayList<String>(); for (CompatibleDuties cd : compGoal.get(comG)) { BindingOfDuties g = cd.getTarget(); if (comG == g) g = cd.getSource(); if (g != null && g instanceof Goal) comp.add("%b" + ((Goal) g).getName() + "%"); } if (comp.size() > 0) { String s = "%b" + comG.getName() + "% should be combined with " + separateListOfString(comp) + ", given that %iBoD% constraint is specified between these goals."; phrases.add(createParagraph(s.toString())); } } if (incompRole.size() > 0 || incompGoal.size() > 0 || compGoal.size() > 0 || compRole.size() > 0) { String s = "In the " + getProjectName() + " project" + socialDiagRef() + " the following organisational constraints have been specified:"; section.add(createParagraph(s)); section.add(listParagraphs(phrases)); section.add(createParagraph(ftc.getTable(FigureConstant.ORG_CONSTR_TABLE) + " summarises the organisational constraints for the " + getProjectName() + " project.")); List<String[]> headers = new ArrayList<String[]>(); headers.add(new String[] { "Organisational", "Constraint" }); headers.add(new String[] { "Role/Goal" }); headers.add(new String[] { "Role/Goal" }); headers.add(new String[] { "Description" }); PdfPTable table = createTable(headers); if (incompRole.size() > 0) { int sodRoleRowspan = 0; for (List<IncompatibleDuties> idList : incompRole.values()) { sodRoleRowspan += idList.size(); } PdfPCell soDRoleCell = getContentCell(new String[] { "SoD", "(Role - Role)" }); soDRoleCell.setRowspan(sodRoleRowspan); table.addCell(soDRoleCell); for (Role r : incompRole.keySet()) { List<IncompatibleDuties> idList = incompRole.get(r); PdfPCell sRole = getContentCell(r.getName()); sRole.setRowspan(idList.size()); table.addCell(sRole); for (IncompatibleDuties id : idList) { Role tr = (Role) id.getTarget(); if (tr == r) tr = (Role) id.getSource(); table.addCell(getContentCell(tr.getName())); String desc = id.getDescription(); if (desc == null) desc = ""; table.addCell(getContentCell(desc)); } } } if (compRole.size() > 0) { int bodRoleRowspan = 0; for (List<CompatibleDuties> lr : compRole.values()) { bodRoleRowspan += lr.size(); } PdfPCell boDRoleCell = getContentCell(new String[] { "BoD", "(Role - Role)" }); boDRoleCell.setRowspan(bodRoleRowspan); table.addCell(boDRoleCell); for (Role r : compRole.keySet()) { List<CompatibleDuties> rl = compRole.get(r); PdfPCell sRole = getContentCell(r.getName()); sRole.setRowspan(rl.size()); table.addCell(sRole); for (CompatibleDuties id : rl) { Role tr = (Role) id.getTarget(); if (tr == r) tr = (Role) id.getSource(); table.addCell(getContentCell(tr.getName())); String desc = id.getDescription(); if (desc == null) desc = ""; table.addCell(getContentCell(desc)); } } } if (incompGoal.size() > 0) { int sodGoalRowspan = 0; for (List<IncompatibleDuties> idList : incompGoal.values()) { sodGoalRowspan += idList.size(); } PdfPCell soDGoalCell = getContentCell(new String[] { "SoD", "(Goal - Goal)" }); soDGoalCell.setRowspan(sodGoalRowspan); table.addCell(soDGoalCell); for (Goal g : incompGoal.keySet()) { List<IncompatibleDuties> rl = incompGoal.get(g); PdfPCell sGoal = getContentCell(g.getName()); sGoal.setRowspan(rl.size()); table.addCell(sGoal); for (IncompatibleDuties id : rl) { Goal tg = (Goal) id.getTarget(); if (tg == g) tg = (Goal) id.getSource(); table.addCell(getContentCell(tg.getName())); String desc = id.getDescription(); if (desc == null) desc = ""; table.addCell(getContentCell(desc)); } } } if (compGoal.size() > 0) { int bodGoalRowspan = 0; for (List<CompatibleDuties> lr : compGoal.values()) { bodGoalRowspan += lr.size(); } PdfPCell boDGoalCell = getContentCell(new String[] { "BoD", "(Goal - Goal)" }); boDGoalCell.setRowspan(bodGoalRowspan); table.addCell(boDGoalCell); for (Goal g : compGoal.keySet()) { List<CompatibleDuties> rl = compGoal.get(g); PdfPCell sGoal = getContentCell(g.getName()); sGoal.setRowspan(rl.size()); table.addCell(sGoal); for (CompatibleDuties id : rl) { Goal tg = (Goal) id.getTarget(); if (tg == g) tg = (Goal) id.getSource(); table.addCell(getContentCell(tg.getName())); String desc = id.getDescription(); if (desc == null) desc = ""; table.addCell(getContentCell(desc)); } } } /* * PdfPCell soDRoleCell = getContentCell("Sod"); * soDRoleCell.setRowspan(sodRowspan); table.addCell(soDRoleCell); * * for(Role r :sodRole.keySet()){ List<IncompatibleDuties> * rl=sodRole.get(r); PdfPCell sRole = getContentCell(r.getName()); * sRole.setRowspan(rl.size()); table.addCell(sRole); * for(IncompatibleDuties id:rl){ Role tr=(Role)id.getTarget(); * if(tr==r)tr=(Role)id.getSource(); * table.addCell(getContentCell(tr.getName())); String * desc=id.getDescription(); if(desc==null)desc=""; * table.addCell(getContentCell(desc)); } } */ section.add(table); addTableCaption(table, ftc.getTable(FigureConstant.ORG_CONSTR_TABLE) + " - Organisational Constraints"); table.setComplete(true); } else { section.add(createParagraph( "In the " + getProjectName() + " project there are no organisational constraints specified.")); } section.setComplete(true); }
From source file:eu.aniketos.wp1.ststool.report.pdfgenerator.ReportContentFactory.java
License:Open Source License
private void buildEventsSection(Section section) { Set<Event> events = getDiagram().getAllEvents(); if (events.size() > 0) { String sectionIntro = ftc.getTable(FigureConstant.EVENT_TABLE) + " represents all the events modeled in the project " + getProjectName() + " together with the set of elements each event threatens. Additionally, for each reported event a textual description is provided, which is extracted from the threat repository."; section.add(createParagraph(sectionIntro)); List<String[]> headers = new ArrayList<String[]>();// headers.add(new String[] { "Event name" }); headers.add(new String[] { "Threatened elements" }); headers.add(new String[] { "Description" }); PdfPTable table = createTable(headers); // List<Event> e1l=new ArrayList<Event>(); // List<Event> e2l=new ArrayList<Event>(); // /* w w w.j a v a2 s . c o m*/ // for(Event e:events){ // if(e.getEventID()!=null && e.getEventID().length()>0) // e1l.add(e); // else{ // e2l.add(e); // } // } // List<Event> ordredevents = new ArrayList(events); // for(Event e:e1l) Collections.sort(ordredevents, new Comparator<Event>() { @Override public int compare(Event e1, Event e2) { int i1 = (e1.getEventID() != null && e1.getEventID().length() > 0) ? 0 : 1; int i2 = (e1.getEventID() != null && e1.getEventID().length() > 0) ? 0 : -1; return i1 + i2; } }); for (Event e : ordredevents) { table.addCell(getContentCell(e.getName())); if (e.getThreatedElements().size() > 0) { List<String> threat = new ArrayList<String>(); for (Threat t : e.getThreatedElements()) { if (t.getTarget() != null && t.getTarget() instanceof StsElement) { threat.add(t.getTarget().eClass().getName() + " : " + ((StsElement) t.getTarget()).getName()); } } String[] phrases = new String[threat.size()]; for (int i = 0; i < phrases.length; i++) { phrases[i] = threat.get(i); } table.addCell(getContentCell(phrases)); } else { table.addCell(getContentCell( new String[] { "No elements are depicted", "to be threatened by this event" }, TABLE_CONTENT_SMALL)); } //table.addCell(getContentCell(e.getEventID(),TABLE_CONTENT_SMALL)); String desc = "No concrete threats from the threat repository have been associated to this event"; if (e.getEventID() != null && e.getEventID().length() > 0) { desc = e.getDescription(); } table.addCell(getContentCell(desc, TABLE_CONTENT_SMALL)); } addTableCaption(table, ftc.getTable(FigureConstant.EVENT_TABLE) + " - Events"); section.add(table); table.setComplete(true); } else { String sectionIntro = "No events have been modeled in the project " + getProjectName(); section.add(createParagraph(sectionIntro)); } section.setComplete(true); }
From source file:eu.aniketos.wp1.ststool.report.pdfgenerator.ReportContentFactory.java
License:Open Source License
private void buildSectionInformationViewDiagram(Section section, Document document) { Image i = rsp.generateScrenshot(ViewsManager.RESOURCE_VIEW); float reductionScale = fitImageInArea(i, document.getPageSize().getWidth() - document.rightMargin() - document.leftMargin(), 310, false); if (reductionScale <= getMaximumReductionScale()) { setAppendixAInformationDiagram(true); }/*from www .j a va 2 s . c o m*/ StringBuilder sectionIntro = new StringBuilder(); sectionIntro.append(ftc.getFigure(FigureConstant.INFORMATION_DIAGRAM) + " presents the graphical representation of the information view"); if (needInformationDiagramInAppendixA()) { sectionIntro.append(" (a larger picture is shown in appendix A)"); } sectionIntro.append("."); section.add(createParagraph(sectionIntro.toString())); section.add(decorateImage(i, ftc.getFigure(FigureConstant.INFORMATION_DIAGRAM) + " - Information View for the " + getProjectName() + " project")); section.setComplete(true); }
From source file:eu.aniketos.wp1.ststool.report.pdfgenerator.ReportContentFactory.java
License:Open Source License
private void buildSectionModellingOwnership(Section section) { String sectionIntro = "The information view represents also who are the %iowners% of the information that is being manipulated through the documents that represent them in the social view."; section.add(createParagraph(sectionIntro)); List<Actor> selActors = getModellingOwnershipActors(); List<Actor> validActors = new ArrayList<Actor>(); for (Actor a : selActors) { if (a.getIResources().size() > 0) validActors.add(a);//from w w w. j a v a2 s . co m } if (validActors.size() > 0) { String s = "The owners for the different information in the " + getProjectName() + " project are summarised in " + ftc.getTable(FigureConstant.INF_OWN_TABLE) + "."; section.add(createParagraph(s)); List<String[]> headers = new ArrayList<String[]>();// headers.add(new String[] { "Agent/Role" }); headers.add(new String[] { "Information" }); headers.add(new String[] { "Description" }); PdfPTable table = createTable(headers); for (Actor a : validActors) { PdfPCell actorCell = getContentCell(a.getName()); actorCell.setRowspan(a.getIResources().size()); table.addCell(actorCell); for (Own o : a.getIResources()) { table.addCell(getContentCell(o.getTarget().getName())); table.addCell(getContentCell(o.getTarget().getDescription())); } } addTableCaption(table, ftc.getTable(FigureConstant.INF_OWN_TABLE) + " - Information owners"); section.add(table); table.setComplete(true); } else { section.add(createParagraph("In the " + getProjectName() + " project there are no relations taking place for the given agents/roles.")); } section.setComplete(true); // section.setTriggerNewPage(true); }
From source file:eu.aniketos.wp1.ststool.report.pdfgenerator.ReportContentFactory.java
License:Open Source License
private void buildSectionRepresentationInformation(Section section) { String sectionIntro = "Information is represented (%imade tangible by%) by documents, which stakeholders have and exchange."; section.add(createParagraph(sectionIntro)); List<Actor> selActor = getRepresentationInformationActors(); Set<IResource> validResource = new HashSet<IResource>(); for (Actor a : selActor) { for (Own o : a.getIResources()) { if (o.getTarget().getTangibleElements().size() > 0) validResource.add(o.getTarget()); }/*from ww w .j a va 2 s.c om*/ } if (validResource.size() > 0) { String s = "The documents stakeholders in the " + getProjectName() + " project" + infDiagRef() + " have and exchange with one another contain the information as summarised in " + ftc.getTable(FigureConstant.RAPPRES_INFORMA_TABLE) + ":"; section.add(createParagraph(s)); List<String[]> headers = new ArrayList<String[]>(); headers.add(new String[] { "Information" }); headers.add(new String[] { "Document" }); headers.add(new String[] { "Description" }); PdfPTable table = createTable(headers); for (IResource r : validResource) { List<TangibleBy> tbList = new ArrayList<TangibleBy>(); for (TangibleBy tb : r.getTangibleElements()) { if (tb.getTarget() != null) { tbList.add(tb); } } if (tbList.size() != 0) { PdfPCell infCell = getContentCell(r.getName()); infCell.setRowspan(tbList.size()); table.addCell(infCell); for (TangibleBy o : tbList) { table.addCell(getContentCell(o.getTarget().getName())); table.addCell(getContentCell(o.getDescription())); } } } addTableCaption(table, ftc.getTable(FigureConstant.RAPPRES_INFORMA_TABLE) + " - Representation of Information through Documents"); section.add(table); table.setComplete(true); } else { section.add(createParagraph("In the " + getProjectName() + " project there are no \"Tangible By\" relations specified for the documents of the given agents/roles.")); } section.setComplete(true); }
From source file:eu.aniketos.wp1.ststool.report.pdfgenerator.ReportContentFactory.java
License:Open Source License
private void buildSectionComposition(Section section) { String sectionIntro = "Documents (information) are composed of other documents (information). Composition of documents (information) is captured through %i part of % relations."; section.add(createParagraph(sectionIntro)); List<Actor> selActor = getCompositionActors(); Set<Resource> validResource = new HashSet<Resource>(); for (Actor a : selActor) { for (Own o : a.getIResources()) { if (o.getTarget().getSubParts().size() > 0) validResource.add(o.getTarget()); }/*from w ww. j a v a2 s . c o m*/ for (TResource r : a.getTResources()) { if (r.getSubParts().size() > 0) validResource.add(r); } } if (validResource.size() > 0) { String s = ftc.getTable(FigureConstant.COMPOSITION_TABLE) + " summarises the documents and information in the " + getProjectName() + " project" + infDiagRef() + ", showing how they are composed and describing the composition."; section.add(createParagraph(s)); List<String[]> headers = new ArrayList<String[]>(); headers.add(new String[] { "Information", "/ Document" }); headers.add(new String[] { "Composition" }); headers.add(new String[] { "Description" }); PdfPTable table = createTable(headers); for (Resource r : validResource) { List<PartOf> pofList = new ArrayList<PartOf>(); for (PartOf p : r.getSubParts()) { if (p.getTarget() != null) pofList.add(p); } if (pofList.size() > 0) { PdfPCell infCell = getContentCell(r.getName()); infCell.setRowspan(pofList.size()); table.addCell(infCell); for (PartOf p : pofList) { table.addCell(getContentCell(p.getSource().getName())); table.addCell(getContentCell(p.getDescription())); } } } addTableCaption(table, ftc.getTable(FigureConstant.COMPOSITION_TABLE) + " - Information and documents composition"); section.add(table); table.setComplete(true); } else { section.add(createParagraph( "In the " + getProjectName() + " project there are no composite documents or information.")); } section.setComplete(true); }
From source file:eu.aniketos.wp1.ststool.report.pdfgenerator.ReportContentFactory.java
License:Open Source License
private void buildSectionAuthorisationDiagram(Section section, Document document) { Image i = rsp.generateScrenshot(ViewsManager.AUTHORIZATION_VIEW); float reductionScale = fitImageInArea(i, document.getPageSize().getWidth() - document.rightMargin() - document.leftMargin(), 310, false); if (reductionScale <= getMaximumReductionScale()) { setAppendixASocialDiagram(true); }/*from w w w . j a v a 2 s. co m*/ StringBuilder sectionIntro = new StringBuilder(); sectionIntro.append(ftc.getFigure(FigureConstant.AUTH_DIAGRAM) + " presents the graphical representation of the Authorisation view"); if (needAuthorisationDiagramInAppendixA()) { sectionIntro.append(" (a larger picture is rappresented in appendix A)"); } sectionIntro.append("."); section.add(createParagraph(sectionIntro.toString())); section.add(decorateImage(i, ftc.getFigure(FigureConstant.AUTH_DIAGRAM) + " - Authorisation View for the " + getProjectName() + " project")); section.setComplete(true); }
From source file:eu.aniketos.wp1.ststool.report.pdfgenerator.ReportContentFactory.java
License:Open Source License
private void buildSectionAuthorisationFlow(Section section) { String sectionIntro = "In this section are described for each role/agent, the authorisations it passes to others and what authorisations it receives from other roles/agents."; section.add(createParagraph(sectionIntro)); List<Actor> selActor = getAuthorisationFlowActors(); List<com.itextpdf.text.List> lists = new ArrayList<com.itextpdf.text.List>(); for (Actor a : selActor) { StringBuilder sbOut = new StringBuilder(); for (Authorisation au : a.getOutgoingAuthorisations()) { if (isValidAuth(au)) { if (sbOut.length() > 0) sbOut.append(", and "); sbOut.append("authorises %i" + au.getTarget().getName() + "% to " + getOperations(au) + " information "); List<String> resList = new ArrayList<String>(); for (IResource r : au.getResources()) resList.add("%i" + r.getName() + "%"); sbOut.append(separateListOfString(resList) + ", "); List<String> goalList = new ArrayList<String>(); if (au.getGoals().size() > 0) { sbOut.append("in the scope of goal"); if (au.getGoals().size() > 1) sbOut.append("s"); // sbOut.append(" "); for (Goal g : au.getGoals()) { goalList.add("%i" + g.getName() + "%"); }/*w ww. jav a 2s. com*/ sbOut.append(" " + separateListOfString(goalList) + ", "); } if (au.getTimesTransferable() == 0) { sbOut.append("%iwithout% passing"); } else { sbOut.append("%ipassing%"); } sbOut.append(" the right to further authorising other actors"); String[] res = new String[resList.size()]; for (int i = 0; i < resList.size(); i++) res[i] = resList.get(i); String[] goals = new String[goalList.size()]; for (int i = 0; i < goalList.size(); i++) goals[i] = goalList.get(i); } } StringBuilder sbInc = new StringBuilder(); for (Authorisation au : a.getIncomingAuthorisations()) { if (isValidAuth(au)) { if (sbInc.length() > 0) sbInc.append(", and "); sbInc.append("is authorised by %i" + au.getSource().getName() + "% to " + getOperations(au) + " information "); List<String> resList = new ArrayList<String>(); for (IResource r : au.getResources()) resList.add("%i" + r.getName() + "%"); sbInc.append(separateListOfString(resList) + ", "); List<String> goalList = new ArrayList<String>(); if (au.getGoals().size() > 0) { sbInc.append("in the scope of goal"); if (au.getGoals().size() > 1) sbOut.append("s"); // sbInc.append(" "); for (Goal g : au.getGoals()) { goalList.add("%i" + g.getName() + "%"); } sbInc.append(" " + separateListOfString(goalList) + ", "); } if (au.getTimesTransferable() == 0) { sbInc.append("%iwithout% having"); } else { sbInc.append("%ihaving%"); } sbInc.append(" the right to further authorising other actors"); String[] res = new String[resList.size()]; for (int i = 0; i < resList.size(); i++) res[i] = resList.get(i); String[] goals = new String[goalList.size()]; for (int i = 0; i < goalList.size(); i++) goals[i] = goalList.get(i); } } if (sbOut.length() > 0 || sbInc.length() > 0) { String type = "%iAgent% "; if (a instanceof Role) type = "%iRole% "; 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); } if (sbInc.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() + "% " + // sbInc.toString() + "."); Paragraph p = createParagraph(sbInc.toString() + "."); sublist.add(new ListItem(p)); list.add(sublist); } lists.add(list); } } if (lists.size() > 0) { String s = "In the " + getProjectName() + " project" + autDiagRef() + " the authorisations for each role/agent are:"; section.add(createParagraph(s)); for (com.itextpdf.text.List list : lists) { section.add(list); } } else { section.add(createParagraph("In the " + getProjectName() + " project there are no authorisation taking place for the given agents/roles.")); } section.setComplete(true); }
From source file:eu.aniketos.wp1.ststool.report.pdfgenerator.ReportContentFactory.java
License:Open Source License
private void buildSectionConsistencyAnalysis(final Section section, Document document) { String sectionIntro = "The purpose of consistency analysis is to verify whether the diagram for the project " + getProjectName()/* ww w.java 2 s.c o m*/ + " is consistent and valid. A diagram is considered to be consistent if its constituent elements (concepts and relationships) are drawn and interconnected following the semantics of the modelling language (STS-ml in our case). Thus, consistency analysis performs post checks to verify compliance with STS-ml semantics for all checks that cannot be performed live over the models."; Paragraph pIntro = createParagraph(sectionIntro); pIntro.setSpacingAfter(8); section.add(pIntro); if (generateAppendixBChapter()) { String appBref = "More details about the performed checks and their purpose can be found in Appendix B."; section.add(createParagraph(appBref)); } ConsistencyAnalysisTasks t = new ConsistencyAnalysisTasks(1); DiagramAnalyser analyser = new DiagramAnalyser(); analyser.addTaskGroup(t); AnalysisDescriptor ad = new AnalysisDescriptor("Consistency", FigureConstant.CONSISTENCY_RES_TABLE); analyser.addTaskListener(ad); analyser.evaluateCurrentDiagram(); section.add(ad.getFinalParagraph()); section.setComplete(true); }
From source file:eu.aniketos.wp1.ststool.report.pdfgenerator.ReportContentFactory.java
License:Open Source License
private void buildSectionSecurityAnalysis(Section section) { String sectionIntro = "The purpose of security analysis is to verify whether the diagram for the project " + getProjectName()/*w w w . j av a2 s.co m*/ + " allows the satisfaction of the specified security needs or not. As a result, for all security needs expressed by stakeholders, it checks in the model whether there is any possibility for the security need to be violated. This analysis takes into account the semantics of STS-ml, defining the behaviour of the different elements represented in the models. The elements behaviour is defined by propagation rules that consider what concepts and what relationships the specification of a given security need affects. Datalog is used to define the semantics of STS-ml to express facts (things always hold) and rules."; Paragraph pIntro = createParagraph(sectionIntro); pIntro.setSpacingAfter(8); section.add(pIntro); if (generateAppendixCChapter()) { String appBref = "You can find more details about the performed checks in Appendix C."; section.add(createParagraph(appBref)); } ConsistencyAnalysisTasks t = new ConsistencyAnalysisTasks(1); DiagramAnalyser analyser = new DiagramAnalyser(); analyser.addTaskGroup(t); boolean analysisRes = analyser.evaluateCurrentDiagram(); if (analysisRes) { analyser.removeAllTaskGroups(); analyser.addTaskGroup(new SecurityAnalysisTasks("", 1)); AnalysisDescriptor ad = new AnalysisDescriptor("Security", FigureConstant.SECURITY_RES_TABLE); analyser.addTaskListener(ad); analyser.evaluateCurrentDiagram(); section.add(ad.getFinalParagraph()); } else { Paragraph p = createParagraph("%i" + "The security analysis for " + getProjectName() + " couldn't be performed because the consistency analysis has identified some errors that need to be fixed first." + "% "); p.setIndentationLeft(15); } section.setComplete(true); }