1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package org.springframework.roo.addon.surf.content;
21
22 import org.springframework.roo.shell.CliAvailabilityIndicator;
23 import org.springframework.roo.shell.CliCommand;
24 import org.springframework.roo.shell.CliOption;
25 import org.springframework.roo.shell.CommandMarker;
26 import org.springframework.roo.support.lifecycle.ScopeDevelopmentShell;
27 import org.springframework.roo.support.util.Assert;
28
29
30
31
32
33
34 @ScopeDevelopmentShell
35 public class ContentCommands implements CommandMarker {
36
37 private ContentOperations contentOperations;
38
39
40
41
42 public ContentCommands(ContentOperations contentOperations) {
43 Assert.notNull(contentOperations, "ContentOperations instance required");
44 this.contentOperations = contentOperations;
45 }
46
47
48
49
50
51 @CliAvailabilityIndicator({"surf content association create"})
52 public boolean isNewContentAssociationAvailable() {
53 return contentOperations.isNewContentAssociationAvailable();
54 }
55
56
57
58
59
60
61
62
63 @CliCommand(value="surf content association create", help="Creates a new Surf content association")
64 public void newContentAssociation(
65 @CliOption(key={"id",""}, mandatory=false, help="Specifies id of the content association.") String id,
66 @CliOption(key={"source",""}, mandatory=true, help="Specifies content type of the association.") String contentTypeName,
67 @CliOption(key={"destination",""}, mandatory=true, help="Specifies page id or component id that will be used for rendering the content type.") String desName,
68 @CliOption(key={"type",""}, mandatory=false, specifiedDefaultValue="page",unspecifiedDefaultValue="page", help="Specifies type of the association, i.e. page, etc. ") String type
69 ) {
70 contentOperations.createContentAssociation(id,contentTypeName, desName,type);
71 }
72
73 }