本文整理汇总了Java中com.structurizr.Workspace类的典型用法代码示例。如果您正苦于以下问题:Java Workspace类的具体用法?Java Workspace怎么用?Java Workspace使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Workspace类属于com.structurizr包,在下文中一共展示了Workspace类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: putWorkspace
import com.structurizr.Workspace; //导入依赖的package包/类
@Override
public void putWorkspace(long workspaceId, String json) throws WorkspaceComponentException {
try {
File path = getPathToWorkspace(workspaceId);
File file = new File(path, "workspace.json");
Files.write(file.toPath(), json.getBytes("UTF-8"));
try {
Workspace workspace = WorkspaceUtils.loadWorkspaceFromJson(file);
writeWorkspaceSummary(workspaceId, workspace.getName(), workspace.getDescription(), workspace.getThumbnail());
} catch (Exception e) {
e.printStackTrace();
}
} catch (IOException ioe) {
throw new WorkspaceComponentException("Could not put workspace " + workspaceId, ioe);
}
}
示例2: test_putAndGetWorkspace
import com.structurizr.Workspace; //导入依赖的package包/类
@Test
public void test_putAndGetWorkspace() throws Exception {
Workspace workspace = new Workspace("Name", "Description");
workspace.setThumbnail("Thumbnail");
JsonWriter jsonWriter = new JsonWriter(false);
StringWriter stringWriter = new StringWriter();
jsonWriter.write(workspace, stringWriter);
String content = stringWriter.toString();
workspaceComponent.putWorkspace(1, content);
Properties properties = new Properties();
File propertiesFile = new File(new File(dataDirectory, "1"), "workspace.properties");
properties.load(new FileReader(propertiesFile));
assertEquals("Name", properties.getProperty("name"));
assertEquals("Description", properties.getProperty("description"));
assertEquals("Thumbnail", properties.getProperty("thumbnail"));
assertEquals(content, workspaceComponent.getWorkspace(1));
}
示例3: StyleProvider
import com.structurizr.Workspace; //导入依赖的package包/类
@Autowired
public StyleProvider(Workspace workspace) {
Styles styles = workspace.getViews().getConfiguration().getStyles();
styles.addElementStyle(Tags.ELEMENT).width(500).height(350).color("#ffffff").fontSize(30).shape(Shape.RoundedBox);
styles.addElementStyle(Tags.SOFTWARE_SYSTEM).background("#2A4E6E");
styles.addElementStyle(Tags.CONTAINER).background("#007F0E");
styles.addElementStyle(Tags.COMPONENT).background("#3059BA");
styles.addElementStyle(Tags.PERSON).width(475).background("#728da5").shape(Shape.Person);
styles.addRelationshipStyle(Tags.RELATIONSHIP).dashed(true).thickness(5).fontSize(40).width(400);
styles.addRelationshipStyle(Tags.SYNCHRONOUS).dashed(false);
styles.addRelationshipStyle(Tags.ASYNCHRONOUS).dashed(true);
}
示例4: main
import com.structurizr.Workspace; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
// a Structurizr workspace is the wrapper for a software architecture model, views and documentation
Workspace workspace = new Workspace("Getting Started", "This is a model of my software system.");
Model model = workspace.getModel();
// add some elements to your software architecture model
Person user = model.addPerson("User", "A user of my software system.");
SoftwareSystem softwareSystem = model.addSoftwareSystem("Software System", "My software system.");
user.uses(softwareSystem, "Uses");
// define some views (the diagrams you would like to see)
ViewSet views = workspace.getViews();
SystemContextView contextView = views.createSystemContextView(softwareSystem, "SystemContext", "An example of a System Context diagram.");
contextView.setPaperSize(PaperSize.A5_Landscape);
contextView.addAllSoftwareSystems();
contextView.addAllPeople();
// add some documentation
StructurizrDocumentationTemplate template = new StructurizrDocumentationTemplate(workspace);
template.addContextSection(softwareSystem, Format.Markdown,
"Here is some context about the software system...\n" +
"\n" +
"![](embed:SystemContext)");
// add some styling
Styles styles = views.getConfiguration().getStyles();
styles.addElementStyle(Tags.SOFTWARE_SYSTEM).background("#1168bd").color("#ffffff");
styles.addElementStyle(Tags.PERSON).background("#08427b").color("#ffffff").shape(Shape.Person);
uploadWorkspaceToStructurizr(workspace);
}
示例5: printPlantUml
import com.structurizr.Workspace; //导入依赖的package包/类
/**
* Prints the plant uml.
*
* @param workspace
* the workspace
* @throws WorkspaceWriterException
* the workspace writer exception
* @throws IOException
* Signals that an I/O exception has occurred.
* @throws InterruptedException
* the interrupted exception
*/
private static void printPlantUml(final Workspace workspace) throws WorkspaceWriterException, IOException, InterruptedException {
StringWriter stringWriter = new StringWriter();
PlantUMLWriter plantUMLWriter = new PlantUMLWriter();
plantUMLWriter.write(workspace, stringWriter);
String allPlantUmlsString = stringWriter.toString();
String systemUml2 = allPlantUmlsString.substring(allPlantUmlsString.lastIndexOf("@startuml"), allPlantUmlsString.lastIndexOf("@enduml") + "@enduml".length());
allPlantUmlsString = allPlantUmlsString.replace(systemUml2,"");
writePlantUml("Citizen-Intelligence-Agency-System-System-Deployment",systemUml2);
String componentUml = allPlantUmlsString.substring(allPlantUmlsString.lastIndexOf("@startuml"), allPlantUmlsString.lastIndexOf("@enduml") + "@enduml".length());
allPlantUmlsString = allPlantUmlsString.replace(componentUml,"");
writePlantUml("Citizen-Intelligence-Agency-System-Web-Application-Components",componentUml);
String containersUml = allPlantUmlsString.substring(allPlantUmlsString.lastIndexOf("@startuml"), allPlantUmlsString.lastIndexOf("@enduml") + "@enduml".length());
allPlantUmlsString = allPlantUmlsString.replace(containersUml,"");
writePlantUml("Citizen-Intelligence-Agency-System-Containers",containersUml);
String systemUml = allPlantUmlsString.substring(allPlantUmlsString.lastIndexOf("@startuml"), allPlantUmlsString.lastIndexOf("@enduml") + "@enduml".length());
allPlantUmlsString = allPlantUmlsString.replace(systemUml,"");
writePlantUml("Citizen-Intelligence-Agency-System-System-Context",systemUml);
String enterpriseUml = allPlantUmlsString.substring(allPlantUmlsString.lastIndexOf("@startuml"), allPlantUmlsString.lastIndexOf("@enduml") + "@enduml".length());
allPlantUmlsString = allPlantUmlsString.replace(enterpriseUml,"");
writePlantUml("Enterprise-Context-for-Hack23",enterpriseUml);
}
示例6: StructurizrService
import com.structurizr.Workspace; //导入依赖的package包/类
@Autowired
public StructurizrService(StructurizrClient structurizrClient, Workspace workspace, StructurizrConfigurationProperties config) {
this.structurizrClient = structurizrClient;
this.workspace = workspace;
this.config = config;
}
示例7: model
import com.structurizr.Workspace; //导入依赖的package包/类
@Bean
Model model(Workspace workspace) {
return workspace.getModel();
}
示例8: workspace
import com.structurizr.Workspace; //导入依赖的package包/类
@Bean
Workspace workspace(StructurizrConfigurationProperties config) {
return new Workspace(config.getName(), config.getDescription());
}
示例9: uploadWorkspaceToStructurizr
import com.structurizr.Workspace; //导入依赖的package包/类
private static void uploadWorkspaceToStructurizr(Workspace workspace) throws Exception {
StructurizrClient structurizrClient = new StructurizrClient(API_KEY, API_SECRET);
structurizrClient.putWorkspace(WORKSPACE_ID, workspace);
}