Skip to content

Commit

Permalink
GTNPORTAL-2682: Rename field 'name' on PageState to 'displayName'
Browse files Browse the repository at this point in the history
  • Loading branch information
nscavell committed Oct 16, 2012
1 parent e785474 commit 1bf7d23
Show file tree
Hide file tree
Showing 18 changed files with 53 additions and 53 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public void update(Page page) throws NullPointerException
{
throw new NullPointerException();
}
page.setTitle(getState().name);
page.setTitle(getState().displayName);
page.setDescription(getState().description);
page.setFactoryId(getState().factoryId);
page.setShowMaxWindow(getState().showMaxWindow);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ public boolean savePage(PageContext page)

//
Described described = dst.adapt(Described.class);
described.setName(page.state.name);
described.setName(page.state.displayName);
described.setDescription(page.state.description);

//
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public class PageState implements Serializable
final String factoryId;

/** . */
final String name;
final String displayName;

/** . */
final String description;
Expand All @@ -59,15 +59,15 @@ public PageState(Page page)

//
this.factoryId = attrs.getValue(MappedAttributes.FACTORY_ID);
this.name = described.getName();
this.displayName = described.getName();
this.description = described.getDescription();
this.accessPermissions = Utils.safeImmutableList(accessPermissions);
this.editPermission = editPermission;
this.showMaxWindow = attrs.getValue(MappedAttributes.SHOW_MAX_WINDOW, false);
}

public PageState(
String name,
String displayName,
String description,
boolean showMaxWindow,
String factoryId,
Expand All @@ -77,7 +77,7 @@ public PageState(
this.editPermission = editPermission;
this.showMaxWindow = showMaxWindow;
this.factoryId = factoryId;
this.name = name;
this.displayName = displayName;
this.description = description;
this.accessPermissions = accessPermissions;
}
Expand All @@ -97,9 +97,9 @@ public String getFactoryId()
return factoryId;
}

public String getName()
public String getDisplayName()
{
return name;
return displayName;
}

public String getDescription()
Expand Down Expand Up @@ -127,7 +127,7 @@ public boolean equals(Object o)
return Safe.equals(editPermission, that.editPermission)
&& showMaxWindow == that.showMaxWindow
&& Safe.equals(factoryId, that.factoryId)
&& Safe.equals(name, that.name)
&& Safe.equals(displayName, that.displayName)
&& Safe.equals(description, that.description)
&& Safe.equals(accessPermissions, that.accessPermissions);
}
Expand All @@ -138,7 +138,7 @@ public int hashCode()
int result = editPermission != null ? editPermission.hashCode() : 0;
result = 31 * result + (showMaxWindow ? 1 : 0);
result = 31 * result + (factoryId != null ? factoryId.hashCode() : 0);
result = 31 * result + (name != null ? name.hashCode() : 0);
result = 31 * result + (displayName != null ? displayName.hashCode() : 0);
result = 31 * result + (description != null ? description.hashCode() : 0);
result = 31 * result + (accessPermissions != null ? accessPermissions.hashCode() : 0);
return result;
Expand All @@ -150,7 +150,7 @@ public Builder builder()
editPermission,
showMaxWindow,
factoryId,
name,
displayName,
description,
accessPermissions
);
Expand All @@ -169,20 +169,20 @@ public static class Builder
private String factoryId;

/** . */
private String name;
private String displayName;

/** . */
private String description;

/** . */
private List<String> accessPermissions;

private Builder(String editPermission, boolean showMaxWindow, String factoryId, String name, String description, List<String> accessPermissions)
private Builder(String editPermission, boolean showMaxWindow, String factoryId, String displayName, String description, List<String> accessPermissions)
{
this.editPermission = editPermission;
this.showMaxWindow = showMaxWindow;
this.factoryId = factoryId;
this.name = name;
this.displayName = displayName;
this.description = description;
this.accessPermissions = accessPermissions;
}
Expand Down Expand Up @@ -211,9 +211,9 @@ public Builder showMaxWindow(boolean showMaxWindow)
return this;
}

public Builder name(String name)
public Builder displayName(String displayName)
{
this.name = name;
this.displayName = displayName;
return this;
}

Expand All @@ -232,7 +232,7 @@ public Builder factoryId(String factoryId)
public PageState build()
{
return new PageState(
name,
displayName,
description,
showMaxWindow,
factoryId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,15 @@ protected final void afterOneBootWithExtention(PortalContainer container) throws

PageContext page = pageService.loadPage(PageKey.parse("portal::classic::home"));
assertNotNull(page);
assertEquals("site 1", page.getState().getName());
assertEquals("site 1", page.getState().getDisplayName());

page = pageService.loadPage(PageKey.parse("portal::classic::page1"));
assertNotNull(page);
assertEquals("site 2", page.getState().getName());
assertEquals("site 2", page.getState().getDisplayName());

page = pageService.loadPage(PageKey.parse("portal::classic::page2"));
assertNotNull(page);
assertEquals("site 2", page.getState().getName());
assertEquals("site 2", page.getState().getDisplayName());

// Test group
portal = dataStorage.getPortalConfig(SiteType.GROUP.getName(), "/platform/administrators");
Expand All @@ -73,12 +73,12 @@ protected final void afterOneBootWithExtention(PortalContainer container) throws

page = pageService.loadPage(PageKey.parse("group::/platform/administrators::page1"));
assertNotNull(page);
assertEquals("site 2", page.getState().getName());
assertEquals("site 2", page.getState().getDisplayName());

// Test user
PageContext dashboard1 = pageService.loadPage(PageKey.parse("user::root::dashboard1"));
assertNotNull(dashboard1);
assertEquals("site 2", dashboard1.getState().getName());
assertEquals("site 2", dashboard1.getState().getDisplayName());

RequestLifeCycle.end();
}
Expand All @@ -103,11 +103,11 @@ protected final void afterFirstBoot(PortalContainer container) throws Exception

PageContext page = pageService.loadPage(PageKey.parse("portal::classic::home"));
assertNotNull(page);
assertEquals("site 1", page.getState().getName());
assertEquals("site 1", page.getState().getDisplayName());

page = pageService.loadPage(PageKey.parse("portal::classic::page1"));
assertNotNull(page);
assertEquals("site 1", page.getState().getName());
assertEquals("site 1", page.getState().getDisplayName());

page = pageService.loadPage(PageKey.parse("portal::classic::page2"));
assertNull(page);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ public void testSavePage() throws Exception

//
PageContext pageContext = pageService.loadPage(page.getPageKey());
pageContext.setState(pageContext.getState().builder().name("MyTitle").showMaxWindow(true).build());
pageContext.setState(pageContext.getState().builder().displayName("MyTitle").showMaxWindow(true).build());
pageService.savePage(pageContext);

//
Expand All @@ -279,7 +279,7 @@ public void testSavePage() throws Exception
assertEquals(false, page2.isShowMaxWindow());

pageContext = pageService.loadPage(page.getPageKey());
assertEquals("MyTitle", pageContext.getState().getName());
assertEquals("MyTitle", pageContext.getState().getDisplayName());
assertEquals(true, pageContext.getState().getShowMaxWindow());
}

Expand Down Expand Up @@ -1235,7 +1235,7 @@ public void testJTA() throws Exception
pageService.savePage(new PageContext(page.getPageKey(), null));

PageContext pageContext = pageService.loadPage(page.getPageKey());
pageContext.setState(pageContext.getState().builder().name("Juuu2 Ziii2").build());
pageContext.setState(pageContext.getState().builder().displayName("Juuu2 Ziii2").build());
pageService.savePage(pageContext);

assertPageFound(0, 10, null, null, null, "Juuu2 Ziii2", "portal::test::searchedpage2");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ public void testPage() throws Exception
assertNotNull(pageContext);

//
assertEquals("test_title", pageContext.getState().getName());
assertEquals("test_title", pageContext.getState().getDisplayName());
assertEquals("test_factory_id", pageContext.getState().getFactoryId());
assertEquals(Arrays.<String>asList("test_access_permissions"), pageContext.getState().getAccessPermissions());
assertEquals("test_edit_permission", pageContext.getState().getEditPermission());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ public void testLoadPage() throws Exception
assertNotNull(pageContext);

//
assertEquals("test_title", pageContext.getState().getName());
assertEquals("test_title", pageContext.getState().getDisplayName());
assertEquals("test_factory_id", pageContext.getState().getFactoryId());
assertEquals(Arrays.<String>asList("test_access_permissions"), pageContext.getState().getAccessPermissions());
assertEquals("test_edit_permission", pageContext.getState().getEditPermission());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public void testSearchPage() throws Exception
session.save();

PageContext pageContext = pageService.loadPage(page.getPageKey());
pageContext.setState(pageContext.getState().builder().name("Juuu Ziii").build());
pageContext.setState(pageContext.getState().builder().displayName("Juuu Ziii").build());
pageService.savePage(pageContext);
session.save();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,19 +60,19 @@ protected void afterSecondBootWithOverride(PortalContainer container) throws Exc
//
PageContext home = pageService.loadPage(PageKey.parse("portal::classic::home"));
assertNotNull(home);
assertEquals("site 1", home.getState().getName());
assertEquals("site 1", home.getState().getDisplayName());

PageContext page1 = pageService.loadPage(PageKey.parse("portal::classic::page1"));
assertNotNull(page1);
assertEquals("site 1", page1.getState().getName());
assertEquals("site 1", page1.getState().getDisplayName());

PageContext page2 = pageService.loadPage(PageKey.parse("portal::classic::page2"));
assertNotNull(page2);
assertEquals("site 2", page2.getState().getName());
assertEquals("site 2", page2.getState().getDisplayName());

PageContext dashboard1 = pageService.loadPage(PageKey.parse("user::root::dashboard1"));
assertNotNull(dashboard1);
assertEquals("site 2", dashboard1.getState().getName());
assertEquals("site 2", dashboard1.getState().getDisplayName());

RequestLifeCycle.end();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,19 +59,19 @@ protected void afterSecondBootWithOverride(PortalContainer container) throws Exc
//
PageContext home = pageService.loadPage(PageKey.parse("portal::classic::home"));
assertNotNull(home);
assertEquals("site 1", home.getState().getName());
assertEquals("site 1", home.getState().getDisplayName());

PageContext page1 = pageService.loadPage(PageKey.parse("portal::classic::page1"));
assertNotNull(page1);
assertEquals("site 2", page1.getState().getName());
assertEquals("site 2", page1.getState().getDisplayName());

PageContext page2 = pageService.loadPage(PageKey.parse("portal::classic::page2"));
assertNotNull(page2);
assertEquals("site 2", page2.getState().getName());
assertEquals("site 2", page2.getState().getDisplayName());

PageContext dashboard1 = pageService.loadPage(PageKey.parse("user::root::dashboard1"));
assertNotNull(dashboard1);
assertEquals("site 2", dashboard1.getState().getName());
assertEquals("site 2", dashboard1.getState().getDisplayName());

RequestLifeCycle.end();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,19 +59,19 @@ protected void afterSecondBootWithOverride(PortalContainer container) throws Exc
//
PageContext home = pageService.loadPage(PageKey.parse("portal::classic::home"));
assertNotNull(home);
assertEquals("site 1", home.getState().getName());
assertEquals("site 1", home.getState().getDisplayName());

PageContext page1 = pageService.loadPage(PageKey.parse("portal::classic::page1"));
assertNotNull(page1);
assertEquals("site 2", page1.getState().getName());
assertEquals("site 2", page1.getState().getDisplayName());

PageContext page2 = pageService.loadPage(PageKey.parse("portal::classic::page2"));
assertNotNull(page2);
assertEquals("site 2", page2.getState().getName());
assertEquals("site 2", page2.getState().getDisplayName());

PageContext dashboard1 = pageService.loadPage(PageKey.parse("user::root::dashboard1"));
assertNotNull(dashboard1);
assertEquals("site 2", dashboard1.getState().getName());
assertEquals("site 2", dashboard1.getState().getDisplayName());

RequestLifeCycle.end();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public void testLoad()
assertNull(page.state);
assertNotNull(page.data);
PageState state = page.getState();
assertEquals("foo_name", state.getName());
assertEquals("foo_name", state.getDisplayName());
assertEquals("foo_description", state.getDescription());
assertEquals(Arrays.asList("foo_access_permission"), state.getAccessPermissions());
assertEquals("foo_edit_permission", state.getEditPermission());
Expand Down Expand Up @@ -121,7 +121,7 @@ public void testLoadPages()
assertNull(page.state);
assertNotNull(page.data);
PageState state = page.getState();
assertEquals("foo_name", state.getName());
assertEquals("foo_name", state.getDisplayName());
assertEquals("foo_description", state.getDescription());
assertEquals(Arrays.asList("foo_access_permission"), state.getAccessPermissions());
assertEquals("foo_edit_permission", state.getEditPermission());
Expand All @@ -133,7 +133,7 @@ public void testLoadPages()
assertNull(page.state);
assertNotNull(page.data);
state = page.getState();
assertEquals("bar_name", state.getName());
assertEquals("bar_name", state.getDisplayName());
assertEquals("bar_description", state.getDescription());
assertEquals(Arrays.asList("bar_access_permission"), state.getAccessPermissions());
assertEquals("bar_edit_permission", state.getEditPermission());
Expand Down Expand Up @@ -320,7 +320,7 @@ public void testClone() throws Exception
assertNull(bar.state);
assertNotNull(bar.data);
PageState state = bar.getState();
assertEquals("foo_name", state.getName());
assertEquals("foo_name", state.getDisplayName());
assertEquals("foo_description", state.getDescription());
assertEquals(Arrays.asList("foo_access_permission"), state.getAccessPermissions());
assertEquals("foo_edit_permission", state.getEditPermission());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public void testInitialization()
assertNotNull(page);

PageState state = page.getState();
assertEquals("Home Page", state.getName());
assertEquals("Home Page", state.getDisplayName());
assertEquals(Arrays.asList("Everyone"), state.getAccessPermissions());
assertEquals("*:/platform/administrators", state.getEditPermission());
assertNull(state.getFactoryId());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ public UserNode renamePageNode(String nodeName, String newNodeLabel)
{
PageState state = page.getState();
String encodedLabel = HTMLEntityEncoder.getInstance().encode(newNodeLabel);
page.setState(state.builder().name(encodedLabel).build());
page.setState(state.builder().displayName(encodedLabel).build());
configService.getPageService().savePage(page);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -518,8 +518,8 @@ public void execute(Event<UIRightClickPopupMenu> event) throws Exception
uiToolPanel.setWorkingComponent(UIPage.class, null);
UIPage uiPage = (UIPage)uiToolPanel.getUIComponent();

if (pageContext.getState().getName() == null)
pageContext.getState().builder().name(node.getLabel());
if (pageContext.getState().getDisplayName() == null)
pageContext.getState().builder().displayName(node.getLabel());

Page page = userService.getDataStorage().getPage(pageId);
pageContext.update(page);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -543,7 +543,7 @@ else if((endCalendar != null) && (currentDate.after(endDate)))
page.setOwnerType(pageContext.getKey().getSite().getTypeName());
page.setOwnerId(pageContext.getKey().getSite().getName());
page.setName(pageContext.getKey().getName());
String title = pageContext.getState().getName();
String title = pageContext.getState().getDisplayName();
String[] accessPermission = pageContext.getState().getAccessPermissions() == null ? null : pageContext.getState().getAccessPermissions().toArray(new String[pageContext.getState().getAccessPermissions().size()]);
if (title == null || title.trim().length() < 1)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ public String getTitle() throws Exception
//
if (page != null)
{
title = page.getState().getName();
title = page.getState().getDisplayName();
return ExpressionUtil.getExpressionValue(this.getApplicationResourceBundle(), title);
}
else
Expand Down
Loading

0 comments on commit 1bf7d23

Please sign in to comment.