diff --git a/ccm-auth-http/src/com/arsdigita/auth/http/Inet4AddressRange.java b/ccm-auth-http/src/com/arsdigita/auth/http/Inet4AddressRange.java index 149166161..1d8012989 100755 --- a/ccm-auth-http/src/com/arsdigita/auth/http/Inet4AddressRange.java +++ b/ccm-auth-http/src/com/arsdigita/auth/http/Inet4AddressRange.java @@ -248,32 +248,32 @@ public class Inet4AddressRange String addrStr = inetAddressToString (addr); String addr2Str = inetAddressToString (addr2); System.out.println ("addr = " + addrStr + "; addr2 = " + addr2Str); - Assert.truth (addrStr.equals (addr2Str)); + Assert.isTrue (addrStr.equals (addr2Str)); // Test makeNetmask. addr = makeNetmask (0); System.out.println ("makeNetmask(0) = " + addr); - Assert.truth (inetAddressToString (addr).equals ("0.0.0.0")); + Assert.isTrue (inetAddressToString (addr).equals ("0.0.0.0")); addr = makeNetmask (8); System.out.println ("makeNetmask(8) = " + addr); - Assert.truth (inetAddressToString (addr).equals ("255.0.0.0")); + Assert.isTrue (inetAddressToString (addr).equals ("255.0.0.0")); addr = makeNetmask (16); System.out.println ("makeNetmask(16) = " + addr); - Assert.truth (inetAddressToString (addr).equals ("255.255.0.0")); + Assert.isTrue (inetAddressToString (addr).equals ("255.255.0.0")); addr = makeNetmask (24); System.out.println ("makeNetmask(24) = " + addr); - Assert.truth (inetAddressToString (addr).equals ("255.255.255.0")); + Assert.isTrue (inetAddressToString (addr).equals ("255.255.255.0")); addr = makeNetmask (28); System.out.println ("makeNetmask(28) = " + addr); - Assert.truth (inetAddressToString (addr).equals ("255.255.255.240")); + Assert.isTrue (inetAddressToString (addr).equals ("255.255.255.240")); addr = makeNetmask (32); System.out.println ("makeNetmask(32) = " + addr); - Assert.truth (inetAddressToString (addr).equals ("255.255.255.255")); + Assert.isTrue (inetAddressToString (addr).equals ("255.255.255.255")); // Test getByName. Inet4AddressRange range @@ -284,7 +284,7 @@ public class Inet4AddressRange = Inet4AddressRange.getByName ("192.168.0.0/255.255.0.0"); System.out.println ("range = " + range.toString ()); // Test equals. - Assert.truth (range.equals (range2)); + Assert.isTrue (range.equals (range2)); range = Inet4AddressRange.getByName ("192.168.0.99"); System.out.println ("range = " + range.toString ()); @@ -292,19 +292,19 @@ public class Inet4AddressRange // Test inRange. range = Inet4AddressRange.getByName ("192.168.0.0/16"); addr = InetAddress.getByName ("192.168.0.99"); - Assert.truth (range.inRange (addr)); + Assert.isTrue (range.inRange (addr)); range = Inet4AddressRange.getByName ("192.168.0.0/24"); addr = InetAddress.getByName ("192.168.2.99"); - Assert.truth (! range.inRange (addr)); + Assert.isTrue (! range.inRange (addr)); range = Inet4AddressRange.getByName ("192.168.0.99"); addr = InetAddress.getByName ("192.168.0.99"); - Assert.truth (range.inRange (addr)); + Assert.isTrue (range.inRange (addr)); range = Inet4AddressRange.getByName ("192.168.0.99"); addr = InetAddress.getByName ("192.168.3.99"); - Assert.truth (! range.inRange (addr)); + Assert.isTrue (! range.inRange (addr)); System.out.println ("All test completed OK."); } diff --git a/ccm-auth-http/src/com/arsdigita/auth/http/ui/UserCSVEntry.java b/ccm-auth-http/src/com/arsdigita/auth/http/ui/UserCSVEntry.java index e2892f958..0deccc450 100755 --- a/ccm-auth-http/src/com/arsdigita/auth/http/ui/UserCSVEntry.java +++ b/ccm-auth-http/src/com/arsdigita/auth/http/ui/UserCSVEntry.java @@ -80,7 +80,7 @@ public class UserCSVEntry { } public static synchronized UserCSVEntry nextEntry() { - Assert.truth(hasMore(), "has more entries"); + Assert.isTrue(hasMore(), "has more entries"); UserCSVEntry entry = new UserCSVEntry(); s_log.debug("Starting entry"); diff --git a/ccm-bookmarks/src/com/arsdigita/bookmarks/Bookmark.java b/ccm-bookmarks/src/com/arsdigita/bookmarks/Bookmark.java index 32f43b27b..f193f0b48 100755 --- a/ccm-bookmarks/src/com/arsdigita/bookmarks/Bookmark.java +++ b/ccm-bookmarks/src/com/arsdigita/bookmarks/Bookmark.java @@ -73,7 +73,7 @@ public class Bookmark extends ACSObject { * */ public static Bookmark retrieveBookmark(BigDecimal bmrkID) { - Assert.assertNotNull(bmrkID); + Assert.exists(bmrkID); return Bookmark.retrieveBookmark(new OID(BASE_DATA_OBJECT_TYPE, bmrkID)); } @@ -87,7 +87,7 @@ public class Bookmark extends ACSObject { * @pre dataObject != null */ public static Bookmark retrieveBookmark(DataObject dataObject) { - Assert.assertNotNull(dataObject); + Assert.exists(dataObject); return new Bookmark(dataObject); } @@ -99,7 +99,7 @@ public class Bookmark extends ACSObject { * @pre oid != null */ public static Bookmark retrieveBookmark(OID oid) { - Assert.assertNotNull(oid); + Assert.exists(oid); DataObject dataObject = SessionManager.getSession().retrieve(oid); @@ -143,7 +143,7 @@ public class Bookmark extends ACSObject { public String getName() { String name = (String)get("bookmark_name"); - Assert.assertNotNull(name); + Assert.exists(name); return name; } @@ -155,7 +155,7 @@ public class Bookmark extends ACSObject { public String getURL() { String url = (String)get("bookmark_url"); - Assert.assertNotNull(url); + Assert.exists(url); return url; } @@ -167,7 +167,7 @@ public class Bookmark extends ACSObject { public String getDescription() { String description = (String)get("bookmark_desc"); - Assert.assertNotNull(description); + Assert.exists(description); return description; } @@ -242,7 +242,7 @@ public class Bookmark extends ACSObject { * */ public void setName(String name) { - Assert.assertNotNull(name); + Assert.exists(name); set("bookmark_name", name); } @@ -252,7 +252,7 @@ public class Bookmark extends ACSObject { * */ public void setURL(String url) { - Assert.assertNotNull(url); + Assert.exists(url); if(url.startsWith("http://")) set("bookmark_url", url); @@ -277,7 +277,7 @@ public class Bookmark extends ACSObject { * */ public void setDescription(String desc) { - //Assert.assertNotNull(desc); + //Assert.exists(desc); set("bookmark_desc",desc); } diff --git a/ccm-bookmarks/src/com/arsdigita/bookmarks/BookmarkCollection.java b/ccm-bookmarks/src/com/arsdigita/bookmarks/BookmarkCollection.java index f6fbed079..fb936c0ff 100755 --- a/ccm-bookmarks/src/com/arsdigita/bookmarks/BookmarkCollection.java +++ b/ccm-bookmarks/src/com/arsdigita/bookmarks/BookmarkCollection.java @@ -37,7 +37,7 @@ public class BookmarkCollection extends DomainCollection { public BigDecimal getID() { BigDecimal id = (BigDecimal)m_dataCollection.get("id"); - Assert.assertNotNull(id); + Assert.exists(id); return id; } @@ -51,7 +51,7 @@ public class BookmarkCollection extends DomainCollection { public DomainObject getDomainObject() { DomainObject domainObject = getBookmark(); - Assert.assertNotNull(domainObject); + Assert.exists(domainObject); return domainObject; } @@ -67,7 +67,7 @@ public class BookmarkCollection extends DomainCollection { Bookmark bookmark = Bookmark.retrieveBookmark(dataObject); - Assert.assertNotNull(bookmark); + Assert.exists(bookmark); return bookmark; } @@ -81,7 +81,7 @@ public class BookmarkCollection extends DomainCollection { public String getName() { String name = (String)m_dataCollection.get("bookmark_name"); - Assert.assertNotNull(name); + Assert.exists(name); return name; } @@ -95,7 +95,7 @@ public class BookmarkCollection extends DomainCollection { public String getURL() { String url = (String)m_dataCollection.get("bookmark_url"); - Assert.assertNotNull(url); + Assert.exists(url); return url; } diff --git a/ccm-bookmarks/src/com/arsdigita/bookmarks/ui/BookmarkBasePage.java b/ccm-bookmarks/src/com/arsdigita/bookmarks/ui/BookmarkBasePage.java index b481b0c2d..1ac996397 100755 --- a/ccm-bookmarks/src/com/arsdigita/bookmarks/ui/BookmarkBasePage.java +++ b/ccm-bookmarks/src/com/arsdigita/bookmarks/ui/BookmarkBasePage.java @@ -146,7 +146,7 @@ public class BookmarkBasePage extends Page { Application application = Application.getCurrentApplication (pageState.getRequest()); - Assert.assertNotNull(application, "application"); + Assert.exists(application, "application"); targetLabel.setLabel (application.getTitle() + " Administration"); @@ -287,7 +287,7 @@ public class BookmarkBasePage extends Page { * @param pc the component to be added */ public void add(Component pc) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); m_body.add(pc); } @@ -319,7 +319,7 @@ public class BookmarkBasePage extends Page { Application app = Application.getCurrentApplication (pageState.getRequest()); - Assert.assertNotNull(app, "Application app"); + Assert.exists(app, "Application app"); link.setChild(new Label(app.getTitle())); link.setTarget(app.getPrimaryURL()); @@ -338,7 +338,7 @@ public class BookmarkBasePage extends Page { Application app = Application.getCurrentApplication (pageState.getRequest()); - Assert.assertNotNull(app, "Application app"); + Assert.exists(app, "Application app"); Application parent = app.getParentApplication(); @@ -359,7 +359,7 @@ public class BookmarkBasePage extends Page { Application app = Application.getCurrentApplication (pageState.getRequest()); - Assert.assertNotNull(app, "Application app"); + Assert.exists(app, "Application app"); label.setLabel(app.getTitle()); } diff --git a/ccm-bookmarks/src/com/arsdigita/bookmarks/ui/BookmarkEditPane.java b/ccm-bookmarks/src/com/arsdigita/bookmarks/ui/BookmarkEditPane.java index 773e62a46..5fa8e3367 100755 --- a/ccm-bookmarks/src/com/arsdigita/bookmarks/ui/BookmarkEditPane.java +++ b/ccm-bookmarks/src/com/arsdigita/bookmarks/ui/BookmarkEditPane.java @@ -109,35 +109,38 @@ public class BookmarkEditPane extends DynamicListWizard { - public BookmarkEditPane() - { - super("Current Bookmarks", - new ListModelBuilder() { - public ListModel makeModel(List l, PageState ps) { - return new BmrkListModel(ps); - } - public void lock() {} - public boolean isLocked() { return true; } - }, - "Add a new Bookmark", - new Label(GlobalizationUtil.globalize("bookmarks.ui.select_a_bookmark_for_editing"))); + /** + * Constructor + * + */ + public BookmarkEditPane() { + super("Current Bookmarks", new ListModelBuilder() { + public ListModel makeModel(List l, PageState ps) { + return new BmrkListModel(ps); + } + public void lock() {} + public boolean isLocked() { return true; } + }, + "Add a new Bookmark", + new Label(GlobalizationUtil.globalize( + "bookmarks.ui.select_a_bookmark_for_editing"))); final DynamicListWizard dlw = this; - m_prtlRL = new RequestLocal() - { - protected Object initialValue(PageState ps) - { - return (BookmarkApplication)Application.getCurrentApplication(ps.getRequest()); - } - }; + m_prtlRL = new RequestLocal() { + protected Object initialValue(PageState ps) { + return (BookmarkApplication)Application.getCurrentApplication( + ps.getRequest()); + } + }; // FORM FOR ADDING NEW Bookmarks Form addForm = new Form("addBookmark", new GridPanel(2)); - addForm.add(new Label(GlobalizationUtil.globalize("bookmarks.ui.name_of_new_bookmark"))); + addForm.add(new Label(GlobalizationUtil.globalize( + "bookmarks.ui.name_of_new_bookmark"))); final TextField newBmrkName = new TextField("name"); newBmrkName.getParameterModel().addParameterListener @@ -205,7 +208,7 @@ public class BookmarkEditPane extends DynamicListWizard { newBmrk.save(); }}.run(); - dlw.getList() + dlw.getListOfComponents() .getSelectionModel() .setSelectedKey(ps, newBmrk.getID().toString()); } @@ -222,7 +225,9 @@ public class BookmarkEditPane extends DynamicListWizard { m_mainDisplay.add(m_editBmrkForm); - ActionLink deleteLink = new ActionLink( (String) GlobalizationUtil.globalize("bookmarks.ui.delete_this_bookmark").localize()); + ActionLink deleteLink = new ActionLink( + (String) GlobalizationUtil.globalize( + "bookmarks.ui.delete_this_bookmark").localize()); deleteLink.setClassAttr("actionLink"); deleteLink.addActionListener(new DeleteLinkListener()); @@ -247,7 +252,8 @@ public class BookmarkEditPane extends DynamicListWizard { public Component getComponent(List list, PageState state, Object value, String key, int index, boolean isSelected) { - BookmarkApplication app = (BookmarkApplication) Web.getContext().getApplication(); + BookmarkApplication app = (BookmarkApplication) Web.getContext() + .getApplication(); BookmarkCollection bColl = app.getBookmarks(); final long size = bColl.size(); bColl.close(); @@ -339,65 +345,72 @@ public class BookmarkEditPane extends DynamicListWizard { public EditBookmarkForm(GridPanel gp) { super("editbookmarkform",gp); - instruction = new Label(GlobalizationUtil.globalize("bookmarks.ui.edit_fields_and_click_save_button")); + instruction = new Label(GlobalizationUtil.globalize( + "bookmarks.ui.edit_fields_and_click_save_button")); blank = new Label(" "); - instruction1 = new Label(GlobalizationUtil.globalize("bookmarks.ui.bookmark_name")); - instruction2 = new Label(GlobalizationUtil.globalize("bookmarks.ui.bookmark_url")); - instruction3 = new Label(GlobalizationUtil.globalize("bookmarks.ui.bookmark_description")); + instruction1 = new Label(GlobalizationUtil.globalize( + "bookmarks.ui.bookmark_name")); + instruction2 = new Label(GlobalizationUtil.globalize( + "bookmarks.ui.bookmark_url")); + instruction3 = new Label(GlobalizationUtil.globalize( + "bookmarks.ui.bookmark_description")); blank1 = new Label(""); blank2 = new Label(""); blank3 = new Label(""); blank4 = new Label(""); - creationDateLabel = new Label(GlobalizationUtil.globalize("bookmarks.ui.creation_date")); - modDateLabel = new Label(GlobalizationUtil.globalize("bookmarks.ui.last_modified_date")); - authorLabel = new Label(GlobalizationUtil.globalize("bookmarks.ui.created_by")); - visitsLabel = new Label(GlobalizationUtil.globalize("bookmarks.ui.number_of_visits")); + creationDateLabel = new Label(GlobalizationUtil.globalize( + "bookmarks.ui.creation_date")); + modDateLabel = new Label(GlobalizationUtil.globalize( + "bookmarks.ui.last_modified_date")); + authorLabel = new Label(GlobalizationUtil.globalize( + "bookmarks.ui.created_by")); + visitsLabel = new Label(GlobalizationUtil.globalize( + "bookmarks.ui.number_of_visits")); bookmarkName = new TextField("BookmarkName"); bookmarkName.setDefaultValue(""); - bookmarkName.addValidationListener(new NotNullValidationListener("Every Bookmark must have a name!")); + bookmarkName.addValidationListener(new NotNullValidationListener( + "Every Bookmark must have a name!")); - newWindowLabel = new Label(GlobalizationUtil.globalize("bookmarks.ui.bookmark_in_new_window")); + newWindowLabel = new Label(GlobalizationUtil.globalize( + "bookmarks.ui.bookmark_in_new_window")); newWindow = new RadioGroup("newWin"); newWindow.addOption(new Option("true", "Yes")); newWindow.addOption(new Option("false", "No")); try { newWindow.addPrintListener( new PrintListener() { - public void prepare(PrintEvent e) { - PageState s = e.getPageState(); - if(getSelectionModel().isSelected(s)) - { - BigDecimal bd = - new BigDecimal((String) getSelectionModel().getSelectedKey(s)); - Bookmark bmrk = Bookmark.retrieveBookmark(bd); - RadioGroup group = (RadioGroup)e.getTarget(); - group.setValue(s,String.valueOf(bmrk.getNewWindow())); - } + public void prepare(PrintEvent e) { + PageState s = e.getPageState(); + if(getSelectionModel().isSelected(s)) { + BigDecimal bd = new BigDecimal((String) + getSelectionModel().getSelectedKey(s)); + Bookmark bmrk = Bookmark.retrieveBookmark(bd); + RadioGroup group = (RadioGroup)e.getTarget(); + group.setValue(s,String.valueOf(bmrk.getNewWindow())); } - }); + } + }); } catch(java.util.TooManyListenersException e) { } try { - bookmarkName.addPrintListener( new PrintListener() - { - public void prepare(PrintEvent e) - { - PageState s = e.getPageState(); - if(getSelectionModel().isSelected(s)) - { - BigDecimal bd = - new BigDecimal((String) getSelectionModel().getSelectedKey(s)); - Bookmark bmrk = Bookmark.retrieveBookmark(bd); - TextField tf = (TextField)e.getTarget(); - tf.setValue(s,bmrk.getName()); - } + bookmarkName.addPrintListener( new PrintListener() { + public void prepare(PrintEvent e) { + PageState s = e.getPageState(); + if(getSelectionModel().isSelected(s)) { + BigDecimal bd = new BigDecimal((String) + getSelectionModel().getSelectedKey(s)); + Bookmark bmrk = Bookmark.retrieveBookmark(bd); + TextField tf = (TextField)e.getTarget(); + tf.setValue(s,bmrk.getName()); } - }); + } + }); } catch(java.util.TooManyListenersException e) { } bookmarkURL = new TextField("BookmarkURL"); bookmarkURL.setDefaultValue(""); - bookmarkURL.addValidationListener(new NotEmptyValidationListener("White space is not allowed in URLs!")); + bookmarkURL.addValidationListener(new NotEmptyValidationListener( + "White space is not allowed in URLs!")); try { diff --git a/ccm-cms-assets-fileattachment/src/com/arsdigita/cms/contentassets/FileAttachment.java b/ccm-cms-assets-fileattachment/src/com/arsdigita/cms/contentassets/FileAttachment.java index 434685692..5f9f0c515 100755 --- a/ccm-cms-assets-fileattachment/src/com/arsdigita/cms/contentassets/FileAttachment.java +++ b/ccm-cms-assets-fileattachment/src/com/arsdigita/cms/contentassets/FileAttachment.java @@ -129,7 +129,7 @@ public class FileAttachment extends FileAsset { } public void setFileOwner(ContentItem fileOwner) { - Assert.assertNotNull(fileOwner); + Assert.exists(fileOwner); this.setMaster(fileOwner); setAssociation(FILE_OWNER, fileOwner); @@ -227,11 +227,11 @@ public class FileAttachment extends FileAsset { */ public void swapKeys(boolean swapNext) { - Assert.assertTrue(!isNew(), "swapKeys() cannot be called on an " + + Assert.isTrue(!isNew(), "swapKeys() cannot be called on an " + "object that is new"); ContentItem fileOwner = getFileOwner(); - Assert.assertNotNull(fileOwner, "fileOwner must be set for swapKeys() to work"); + Assert.exists(fileOwner, "fileOwner must be set for swapKeys() to work"); Integer currentKey = getFileOrder(); // if the current item is not already ordered, alphabetize diff --git a/ccm-cms-assets-relatedlink/src/com/arsdigita/cms/contentassets/ui/RelatedLinkTableModelBuilder.java b/ccm-cms-assets-relatedlink/src/com/arsdigita/cms/contentassets/ui/RelatedLinkTableModelBuilder.java index 69fa32b3e..15a7da54a 100755 --- a/ccm-cms-assets-relatedlink/src/com/arsdigita/cms/contentassets/ui/RelatedLinkTableModelBuilder.java +++ b/ccm-cms-assets-relatedlink/src/com/arsdigita/cms/contentassets/ui/RelatedLinkTableModelBuilder.java @@ -58,7 +58,7 @@ public class RelatedLinkTableModelBuilder * @return The DataCollection of RelatedLinks */ public DataCollection getLinks(PageState s) { - Assert.truth(m_itemModel.isSelected(s), "item selected"); + Assert.isTrue(m_itemModel.isSelected(s), "item selected"); ContentItem item = m_itemModel.getSelectedItem(s); s_log.debug("Getting related links for " + item.getName()); return RelatedLink.getRelatedLinks(item); diff --git a/ccm-cms-types-contact/src/com/arsdigita/cms/contenttypes/ui/contact/AddContactPropertiesStep.java b/ccm-cms-types-contact/src/com/arsdigita/cms/contenttypes/ui/contact/AddContactPropertiesStep.java index 3818d4de7..d7fd982a5 100644 --- a/ccm-cms-types-contact/src/com/arsdigita/cms/contenttypes/ui/contact/AddContactPropertiesStep.java +++ b/ccm-cms-types-contact/src/com/arsdigita/cms/contenttypes/ui/contact/AddContactPropertiesStep.java @@ -107,7 +107,7 @@ public class AddContactPropertiesStep extends ResettableContainer { protected Object initialValue(PageState s) { ContentItem item = (ContentItem) ((ItemSelectionModel) getSingleSelectionModel()) .getSelectedObject(s); - Assert.assertNotNull(item); + Assert.exists(item); return Contact.getContactForItem(item); } diff --git a/ccm-cms-types-formsectionitem/src/com/arsdigita/cms/formbuilder/FormSectionWrapper.java b/ccm-cms-types-formsectionitem/src/com/arsdigita/cms/formbuilder/FormSectionWrapper.java index cc2855653..5a439c682 100755 --- a/ccm-cms-types-formsectionitem/src/com/arsdigita/cms/formbuilder/FormSectionWrapper.java +++ b/ccm-cms-types-formsectionitem/src/com/arsdigita/cms/formbuilder/FormSectionWrapper.java @@ -95,7 +95,7 @@ public class FormSectionWrapper extends PersistentComponent } public void setFormSectionItem(FormSectionItem item) { - Assert.truth(ContentItem.DRAFT.equals(item.getVersion()), + Assert.isTrue(ContentItem.DRAFT.equals(item.getVersion()), "item is draft"); setAssociation(FORM_SECTION_ITEM, item); diff --git a/ccm-cms/src/com/arsdigita/cms/ArticleImageAssociation.java b/ccm-cms/src/com/arsdigita/cms/ArticleImageAssociation.java index 037b50eea..704ec3bae 100755 --- a/ccm-cms/src/com/arsdigita/cms/ArticleImageAssociation.java +++ b/ccm-cms/src/com/arsdigita/cms/ArticleImageAssociation.java @@ -135,7 +135,7 @@ public class ArticleImageAssociation extends ContentItem { */ public static boolean imageHasAssociation (ImageAsset image) { - Assert.assertNotNull(image); + Assert.exists(image); boolean returnValue = imageHasDirectAssociation(image.getID()); if (!returnValue) { if (!image.getVersion().equals(ContentItem.DRAFT)) { diff --git a/ccm-cms/src/com/arsdigita/cms/CMSContext.java b/ccm-cms/src/com/arsdigita/cms/CMSContext.java index e4bfebe9d..304ed0523 100755 --- a/ccm-cms/src/com/arsdigita/cms/CMSContext.java +++ b/ccm-cms/src/com/arsdigita/cms/CMSContext.java @@ -88,7 +88,7 @@ public final class CMSContext { */ public final ContentSection getContentSection() { // removing this which is not true when viewing category pages - //Assert.assertNotNull(m_section, "section"); + //Assert.exists(m_section, "section"); return m_section; } @@ -119,7 +119,7 @@ public final class CMSContext { */ public final ContentItem getContentItem() { // removing this which is necessarily true in ContentList - //Assert.assertNotNull(m_item, "item"); + //Assert.exists(m_item, "item"); if (s_log.isDebugEnabled() && m_item == null) { s_log.debug("Content item is null"); } diff --git a/ccm-cms/src/com/arsdigita/cms/CategoryTemplateMapping.java b/ccm-cms/src/com/arsdigita/cms/CategoryTemplateMapping.java index 0cdfbb036..06ca2ca2f 100755 --- a/ccm-cms/src/com/arsdigita/cms/CategoryTemplateMapping.java +++ b/ccm-cms/src/com/arsdigita/cms/CategoryTemplateMapping.java @@ -136,7 +136,7 @@ public class CategoryTemplateMapping extends TemplateMapping { * @param sec The ContentSection for which this mapping should be valid. **/ public final void setContentSection(ContentSection sec) { - Assert.assertNotNull(sec); + Assert.exists(sec); setAssociation(SECTION, sec); } @@ -158,7 +158,7 @@ public class CategoryTemplateMapping extends TemplateMapping { * @param cat The Category for which this mapping should be valid. **/ public void setCategory(Category cat) { - Assert.assertNotNull(cat); + Assert.exists(cat); setAssociation(CATEGORY, cat); } @@ -192,7 +192,7 @@ public class CategoryTemplateMapping extends TemplateMapping { * @param t The ContentType for which this mapping should be valid. **/ public void setContentType(ContentType t) { - Assert.assertNotNull(t); + Assert.exists(t); setAssociation(CONTENT_TYPE, t); } @@ -213,7 +213,7 @@ public class CategoryTemplateMapping extends TemplateMapping { * @param b whether the template is the default within its context. */ public void setDefault(Boolean b) { - Assert.assertNotNull(b); + Assert.exists(b); set(IS_DEFAULT, b); } @@ -237,7 +237,7 @@ public class CategoryTemplateMapping extends TemplateMapping { c.addEqualsFilter(TEMPLATE + "." + ACSObject.ID, template.getID()); if(!c.next()) return null; CategoryTemplateMapping m = (CategoryTemplateMapping)c.getDomainObject(); - Assert.assertTrue(!c.next()); + Assert.isTrue(!c.next()); c.close(); return m; } @@ -260,7 +260,7 @@ public class CategoryTemplateMapping extends TemplateMapping { if(!c.next()) return null; CategoryTemplateMapping m = (CategoryTemplateMapping)c.getDomainObject(); // FIXME: There HAS to be a better way to enforce uniqueness here... - Assert.assertTrue(!c.next()); + Assert.isTrue(!c.next()); c.close(); return m.getTemplate(); } diff --git a/ccm-cms/src/com/arsdigita/cms/ContentBundle.java b/ccm-cms/src/com/arsdigita/cms/ContentBundle.java index a3636b612..8288cdafc 100755 --- a/ccm-cms/src/com/arsdigita/cms/ContentBundle.java +++ b/ccm-cms/src/com/arsdigita/cms/ContentBundle.java @@ -197,7 +197,7 @@ public class ContentBundle extends ContentItem { public final void setDefaultLanguage(final String language) { if (Assert.isEnabled()) { Assert.exists(language, String.class); - Assert.truth(language.length() == 2, + Assert.isTrue(language.length() == 2, language + " is not an ISO639 language code"); } @@ -224,7 +224,7 @@ public class ContentBundle extends ContentItem { if (Assert.isEnabled()) { Assert.exists(instance, ContentItem.class); - Assert.falsity(hasInstance(instance.getLanguage()), + Assert.isFalse(hasInstance(instance.getLanguage()), "The bundle already contains an instance " + "for the language " + instance.getLanguage()); } @@ -233,7 +233,7 @@ public class ContentBundle extends ContentItem { instance.setContentSection(getContentSection()); if (Assert.isEnabled()) { - Assert.equal(this, instance.getParent()); + Assert.isEqual(this, instance.getParent()); } } @@ -252,14 +252,14 @@ public class ContentBundle extends ContentItem { public void removeInstance(final ContentItem instance) { if (Assert.isEnabled()) { Assert.exists(instance, ContentItem.class); - Assert.equal(this, instance.getParent()); - Assert.unequal(instance, getPrimaryInstance()); + Assert.isEqual(this, instance.getParent()); + Assert.isNotEqual(instance, getPrimaryInstance()); } instance.setParent(null); if (Assert.isEnabled()) { - Assert.truth(instance.getParent() == null); + Assert.isTrue(instance.getParent() == null); } } @@ -301,7 +301,7 @@ public class ContentBundle extends ContentItem { public final ContentItem getInstance(final String language) { if (Assert.isEnabled()) { Assert.exists(language, String.class); - Assert.truth(language.length() == 2, + Assert.isTrue(language.length() == 2, language + " does not look like a valid language " + "code"); } @@ -315,7 +315,7 @@ public class ContentBundle extends ContentItem { final DataObject data = instances.getDataObject(); if (Assert.isEnabled()) { - //Assert.falsity(instances.next(), + //Assert.isFalse(instances.next(), // "There is more than one instance with the " + // "same language"); } @@ -357,7 +357,7 @@ public class ContentBundle extends ContentItem { public final boolean hasInstance(final String language) { if (Assert.isEnabled()) { Assert.exists(language, String.class); - Assert.truth(language.length() == 2, + Assert.isTrue(language.length() == 2, language + " is not an ISO639 language code"); } @@ -390,7 +390,7 @@ public class ContentBundle extends ContentItem { items.close(); if (Assert.isEnabled()) { - Assert.truth(!list.isEmpty() || getInstances().isEmpty()); + Assert.isTrue(!list.isEmpty() || getInstances().isEmpty()); } return list; @@ -407,7 +407,7 @@ public class ContentBundle extends ContentItem { * @pre locales != null */ public ContentItem negotiate(Locale[] locales) { - Assert.assertNotNull(locales); + Assert.exists(locales); DataAssociationCursor instancesCursor = instances(); DataObject dataObject = null; int bestMatch = 0; @@ -462,7 +462,7 @@ public class ContentBundle extends ContentItem { * @pre locales != null */ public ContentItem negotiate(Enumeration locales) { - Assert.assertNotNull(locales); + Assert.exists(locales); /* copy "locales" enumeration, since we have to iterate * over it several times */ diff --git a/ccm-cms/src/com/arsdigita/cms/ContentItem.java b/ccm-cms/src/com/arsdigita/cms/ContentItem.java index dab54d4aa..750dc4aea 100755 --- a/ccm-cms/src/com/arsdigita/cms/ContentItem.java +++ b/ccm-cms/src/com/arsdigita/cms/ContentItem.java @@ -1054,7 +1054,7 @@ public class ContentItem extends VersionedACSObject implements CustomCopy { } if (Assert.isEnabled()) { - Assert.truth(version == null || LIVE.equals(version.getVersion()), + Assert.isTrue(version == null || LIVE.equals(version.getVersion()), "Item version " + version + " must be null or " + "the live version"); } @@ -1195,7 +1195,7 @@ public class ContentItem extends VersionedACSObject implements CustomCopy { if (Assert.isEnabled()) { Assert.exists(pending, ContentItem.class); - Assert.truth(PENDING.equals(pending.getVersion()) || + Assert.isTrue(PENDING.equals(pending.getVersion()) || LIVE.equals(pending.getVersion()), "The new pending item must be pending or live; " + "instead it is " + pending.getVersion()); @@ -1273,7 +1273,7 @@ public class ContentItem extends VersionedACSObject implements CustomCopy { applyTag( "Republished" ); Versions.suspendVersioning(); - Assert.truth( isLive(), "Attempt to republish non live item " + getOID() ); + Assert.isTrue( isLive(), "Attempt to republish non live item " + getOID() ); Lifecycle cycle = getLifecycle(); Assert.exists( cycle, Lifecycle.class ); @@ -1936,21 +1936,21 @@ public class ContentItem extends VersionedACSObject implements CustomCopy { * Assert that this item is a draft version */ public final void assertDraft() { - Assert.equal(DRAFT, getVersion()); + Assert.isEqual(DRAFT, getVersion()); } /** * Assert that this item is a pending version */ public final void assertPending() { - Assert.equal(PENDING, getVersion()); + Assert.isEqual(PENDING, getVersion()); } /** * Assert that this item is a live version */ public final void assertLive() { - Assert.equal(LIVE, getVersion()); + Assert.isEqual(LIVE, getVersion()); } // @@ -1962,7 +1962,7 @@ public class ContentItem extends VersionedACSObject implements CustomCopy { * @deprecated with no replacement */ public final void assertMaster() { - Assert.truth(isMaster(), "Item " + getOID() + " is a top-level item"); + Assert.isTrue(isMaster(), "Item " + getOID() + " is a top-level item"); } // @@ -1986,7 +1986,7 @@ public class ContentItem extends VersionedACSObject implements CustomCopy { } ContentItem get() { - Assert.truth(m_cached); + Assert.isTrue(m_cached); return m_version; } diff --git a/ccm-cms/src/com/arsdigita/cms/ContentSection.java b/ccm-cms/src/com/arsdigita/cms/ContentSection.java index 91dec0641..ef6127cd7 100755 --- a/ccm-cms/src/com/arsdigita/cms/ContentSection.java +++ b/ccm-cms/src/com/arsdigita/cms/ContentSection.java @@ -243,7 +243,7 @@ public class ContentSection extends Application { */ // public PackageInstance getPackageInstance() { // DataObject pkg = (DataObject) get(PACKAGE); -// Assert.assertNotNull(pkg, "package instance"); +// Assert.exists(pkg, "package instance"); // return new PackageInstance(pkg); // } @@ -254,7 +254,7 @@ public class ContentSection extends Application { * @pre ( pkg != null ) */ // protected void setPackageInstance(PackageInstance pkg) { -// Assert.assertNotNull(pkg, "package instance"); +// Assert.exists(pkg, "package instance"); // setAssociation(PACKAGE, pkg); // } @@ -309,8 +309,8 @@ public class ContentSection extends Application { // public final String getPath() { // final String path = getSiteNode().getURL(); // -// if (Assert.isAssertEnabled()) { -// Assert.assertTrue(path.endsWith("/")); +// if (Assert.isEnabled()) { +// Assert.isTrue(path.endsWith("/")); // } // // return path.substring(0, path.length() - 1); @@ -328,7 +328,7 @@ public class ContentSection extends Application { */ public Folder getRootFolder() { DataObject folder = (DataObject) get(ROOT_FOLDER); - Assert.assertNotNull(folder, "root folder"); + Assert.exists(folder, "root folder"); return new Folder(folder); } @@ -338,7 +338,7 @@ public class ContentSection extends Application { * @param root The root folder */ public void setRootFolder(Folder root) { - Assert.assertNotNull(root, "root folder"); + Assert.exists(root, "root folder"); // Update the content section of the old and new root folders. // This is necessary because the content section is used to determine @@ -397,7 +397,7 @@ public class ContentSection extends Application { public Category getRootCategory() { Category category = Category.getRootForObject(this); - Assert.assertNotNull(category, "root category"); + Assert.exists(category, "root category"); return category; } @@ -411,7 +411,7 @@ public class ContentSection extends Application { * @pre ( root != null ) */ public void setRootCategory(Category root) { - Assert.assertNotNull(root, "root category"); + Assert.exists(root, "root category"); Category.setRootForObject(this, root); } @@ -423,7 +423,7 @@ public class ContentSection extends Application { */ public Group getStaffGroup() { DataObject group = (DataObject) get(STAFF_GROUP); - Assert.assertNotNull(group, "staff group"); + Assert.exists(group, "staff group"); return new Group(group); } @@ -434,7 +434,7 @@ public class ContentSection extends Application { * @pre ( group != null ) */ public void setStaffGroup(Group group) { - Assert.assertNotNull(group, "staff group"); + Assert.exists(group, "staff group"); setAssociation(STAFF_GROUP, group); } @@ -446,7 +446,7 @@ public class ContentSection extends Application { */ public Group getViewersGroup() { DataObject group = (DataObject) get(VIEWERS_GROUP); - Assert.assertNotNull(group, "viewers group"); + Assert.exists(group, "viewers group"); return new Group(group); } @@ -457,7 +457,7 @@ public class ContentSection extends Application { * @pre ( group != null ) */ public void setViewersGroup(Group group) { - Assert.assertNotNull(group, "viewers group"); + Assert.exists(group, "viewers group"); setAssociation(VIEWERS_GROUP, group); } @@ -469,7 +469,7 @@ public class ContentSection extends Application { */ public String getPageResolverClass() { String prc = (String) get(PAGE_RESOLVER_CLASS); - Assert.assertNotNull(prc, "Page Resolver class"); + Assert.exists(prc, "Page Resolver class"); return prc; } @@ -526,7 +526,7 @@ public class ContentSection extends Application { */ public String getItemResolverClass() { String irc = (String) get(ITEM_RESOLVER_CLASS); - Assert.assertNotNull(irc, "Content Item Resolver class"); + Assert.exists(irc, "Content Item Resolver class"); s_log.debug("Content Item Resolver Class is " + irc); return irc; } @@ -573,7 +573,7 @@ public class ContentSection extends Application { */ public String getTemplateResolverClass() { String trc = (String) get(TEMPLATE_RESOLVER_CLASS); - Assert.assertNotNull(trc, "Template Resolver class"); + Assert.exists(trc, "Template Resolver class"); return trc; } @@ -618,7 +618,7 @@ public class ContentSection extends Application { */ public String getXMLGeneratorClass() { String xgc = (String) get(XML_GENERATOR_CLASS); - Assert.assertNotNull(xgc, "XML Generator class"); + Assert.exists(xgc, "XML Generator class"); return xgc; } diff --git a/ccm-cms/src/com/arsdigita/cms/Folder.java b/ccm-cms/src/com/arsdigita/cms/Folder.java index 1d15cc426..d9ff7e9d3 100755 --- a/ccm-cms/src/com/arsdigita/cms/Folder.java +++ b/ccm-cms/src/com/arsdigita/cms/Folder.java @@ -240,7 +240,7 @@ public class Folder extends ContentItem { DataQueryDataCollectionAdapter adapter = new DataQueryDataCollectionAdapter(ITEMS_QUERY, ITEM); adapter.setParameter(PARENT, getID()); - Assert.unequal(PENDING, getVersion()); + Assert.isNotEqual(PENDING, getVersion()); adapter.setParameter(VERSION, getVersion()); return new ItemCollection(adapter, bSort); @@ -268,7 +268,7 @@ public class Folder extends ContentItem { (PRIMARY_INSTANCES_QUERY); query.setParameter(PARENT, getID()); - Assert.unequal(PENDING, getVersion()); + Assert.isNotEqual(PENDING, getVersion()); query.setParameter(VERSION, getVersion()); @@ -431,7 +431,7 @@ public class Folder extends ContentItem { } public void removePendingVersion(final ContentItem version) { - Assert.unequal(PENDING, version.getVersion()); + Assert.isNotEqual(PENDING, version.getVersion()); return; } diff --git a/ccm-cms/src/com/arsdigita/cms/ItemTemplateMapping.java b/ccm-cms/src/com/arsdigita/cms/ItemTemplateMapping.java index c6569e5a1..2fdf9882a 100755 --- a/ccm-cms/src/com/arsdigita/cms/ItemTemplateMapping.java +++ b/ccm-cms/src/com/arsdigita/cms/ItemTemplateMapping.java @@ -136,7 +136,7 @@ public class ItemTemplateMapping extends TemplateMapping { if(!c.next()) return null; ItemTemplateMapping m = (ItemTemplateMapping)c.getDomainObject(); // FIXME: There HAS to be a better way to enforce uniqueness here... - Assert.assertTrue(!c.next()); + Assert.isTrue(!c.next()); c.close(); return m; } diff --git a/ccm-cms/src/com/arsdigita/cms/PublishedLink.java b/ccm-cms/src/com/arsdigita/cms/PublishedLink.java index f1bd29791..f10b49273 100755 --- a/ccm-cms/src/com/arsdigita/cms/PublishedLink.java +++ b/ccm-cms/src/com/arsdigita/cms/PublishedLink.java @@ -262,7 +262,7 @@ class PublishedLink extends DomainObject { if (target != null) { ObjectType ot = src.getObjectType(); Property prop = ot.getProperty(propertyName); - Assert.assertNotNull(prop, propertyName + " for type " + ot.getQualifiedName() + ", ID: " + src.get("id")); + Assert.exists(prop, propertyName + " for type " + ot.getQualifiedName() + ", ID: " + src.get("id")); if (prop.isCollection()) { DataAssociation da = (DataAssociation) src.get(propertyName); da.add(target); diff --git a/ccm-cms/src/com/arsdigita/cms/SectionTemplateMapping.java b/ccm-cms/src/com/arsdigita/cms/SectionTemplateMapping.java index ee25553b8..2afda201e 100755 --- a/ccm-cms/src/com/arsdigita/cms/SectionTemplateMapping.java +++ b/ccm-cms/src/com/arsdigita/cms/SectionTemplateMapping.java @@ -86,7 +86,7 @@ public class SectionTemplateMapping extends TemplateMapping { } public final void setContentSection(ContentSection sec) { - Assert.assertNotNull(sec); + Assert.exists(sec); setAssociation(SECTION, sec); } @@ -100,7 +100,7 @@ public class SectionTemplateMapping extends TemplateMapping { } public final void setContentType(ContentType t) { - Assert.assertNotNull(t); + Assert.exists(t); setAssociation(CONTENT_TYPE, t); } @@ -117,7 +117,7 @@ public class SectionTemplateMapping extends TemplateMapping { * context */ public void setDefault(Boolean b) { - Assert.assertNotNull(b); + Assert.exists(b); set(IS_DEFAULT, b); } @@ -148,7 +148,7 @@ public class SectionTemplateMapping extends TemplateMapping { } if(!c.next()) return null; SectionTemplateMapping m = (SectionTemplateMapping)c.getDomainObject(); - Assert.assertTrue(!c.next()); + Assert.isTrue(!c.next()); c.close(); return m; } @@ -169,7 +169,7 @@ public class SectionTemplateMapping extends TemplateMapping { if(!c.next()) return null; SectionTemplateMapping m = (SectionTemplateMapping)c.getDomainObject(); // FIXME: There HAS to be a better way to enforce uniqueness here... - Assert.assertTrue(!c.next()); + Assert.isTrue(!c.next()); c.close(); return m.getTemplate(); } @@ -187,7 +187,7 @@ public class SectionTemplateMapping extends TemplateMapping { if(!c.next()) return null; SectionTemplateMapping m = (SectionTemplateMapping)c.getDomainObject(); // FIXME: There HAS to be a better way to enforce uniqueness here... - Assert.assertTrue(!c.next()); + Assert.isTrue(!c.next()); c.close(); return m.getTemplate(); } diff --git a/ccm-cms/src/com/arsdigita/cms/SecurityManager.java b/ccm-cms/src/com/arsdigita/cms/SecurityManager.java index d04c29ca4..cd4eb1cac 100755 --- a/ccm-cms/src/com/arsdigita/cms/SecurityManager.java +++ b/ccm-cms/src/com/arsdigita/cms/SecurityManager.java @@ -459,7 +459,7 @@ public class SecurityManager implements Security, SecurityConstants { */ private boolean hasPermission(Party party, String privilege) { PrivilegeDescriptor pd = PrivilegeDescriptor.get(privilege); - Assert.assertNotNull(pd, "PrivilegeDescriptor.get(\"" + privilege + "\")"); + Assert.exists(pd, "PrivilegeDescriptor.get(\"" + privilege + "\")"); return hasPermission(party, pd); } @@ -477,7 +477,7 @@ public class SecurityManager implements Security, SecurityConstants { private boolean hasPermission(Party party, String privilege, ContentItem item) { PrivilegeDescriptor pd = PrivilegeDescriptor.get(privilege); - Assert.assertNotNull(pd, "PrivilegeDescriptor.get(\"" + privilege + "\")"); + Assert.exists(pd, "PrivilegeDescriptor.get(\"" + privilege + "\")"); return hasPermission(party, pd, item); } @@ -487,7 +487,7 @@ public class SecurityManager implements Security, SecurityConstants { */ private boolean hasPermission(Party party, PrivilegeDescriptor pd, ContentItem item) { - Assert.assertNotNull(pd, "PrivilegeDescriptor"); + Assert.exists(pd, "PrivilegeDescriptor"); PermissionDescriptor perm = new PermissionDescriptor(pd, item, party); return (PermissionService.checkPermission(perm)); } diff --git a/ccm-cms/src/com/arsdigita/cms/StandalonePage.java b/ccm-cms/src/com/arsdigita/cms/StandalonePage.java index 24e50d3f3..aafd8d096 100755 --- a/ccm-cms/src/com/arsdigita/cms/StandalonePage.java +++ b/ccm-cms/src/com/arsdigita/cms/StandalonePage.java @@ -158,7 +158,7 @@ public class StandalonePage extends ContentPage { */ public void setLive(ContentItem version) { Template t = getTemplate(); - Assert.assertNotNull(t); + Assert.exists(t); if(version != null) t.createLiveVersion(); super.setLive(version); diff --git a/ccm-cms/src/com/arsdigita/cms/TemplateMapping.java b/ccm-cms/src/com/arsdigita/cms/TemplateMapping.java index 8cdf89dfa..019f8d438 100755 --- a/ccm-cms/src/com/arsdigita/cms/TemplateMapping.java +++ b/ccm-cms/src/com/arsdigita/cms/TemplateMapping.java @@ -97,7 +97,7 @@ public abstract class TemplateMapping extends ACSObject { * Set the new template for this mapping */ public void setTemplate(Template t) { - Assert.assertNotNull(t); + Assert.exists(t); setAssociation(TEMPLATE, t); } @@ -112,7 +112,7 @@ public abstract class TemplateMapping extends ACSObject { * Set the use context for this mapping */ public void setUseContext(String context) { - Assert.assertNotNull(context); + Assert.exists(context); set(USE_CONTEXT, context); } diff --git a/ccm-cms/src/com/arsdigita/cms/VersionCopier.java b/ccm-cms/src/com/arsdigita/cms/VersionCopier.java index fb7b292dc..9bc93f803 100755 --- a/ccm-cms/src/com/arsdigita/cms/VersionCopier.java +++ b/ccm-cms/src/com/arsdigita/cms/VersionCopier.java @@ -88,15 +88,15 @@ class VersionCopier extends ObjectCopier { } if (Assert.isEnabled()) { - //Assert.falsity(item instanceof ContentBundle); - //Assert.falsity(item instanceof Folder); - Assert.falsity(m_once); + //Assert.isFalse(item instanceof ContentBundle); + //Assert.isFalse(item instanceof Folder); + Assert.isFalse(m_once); m_once = true; } m_topLevelSourceOID = item.getOID(); final ContentItem version = createVersion(item); - //Assert.truth(m_topLevelSourceOID == null, + //Assert.isTrue(m_topLevelSourceOID == null, // "CopyItem should be called only once for a given copier instance"); if (m_lifecycle != null) { diff --git a/ccm-cms/src/com/arsdigita/cms/contenttypes/ContentGroupAssociation.java b/ccm-cms/src/com/arsdigita/cms/contenttypes/ContentGroupAssociation.java index e5b761cca..1e9ae4d6a 100755 --- a/ccm-cms/src/com/arsdigita/cms/contenttypes/ContentGroupAssociation.java +++ b/ccm-cms/src/com/arsdigita/cms/contenttypes/ContentGroupAssociation.java @@ -98,7 +98,7 @@ public class ContentGroupAssociation extends ContentItem { * Sets the content item for this association */ public void setContentItem(ContentItem item) { - //Assert.assertTrue(item != null, "The ConentItem must not be null"); + //Assert.isTrue(item != null, "The ConentItem must not be null"); set(CONTENT_ITEM, item); } @@ -107,7 +107,7 @@ public class ContentGroupAssociation extends ContentItem { * @pre group != null */ protected void setContentGroup(ContentGroup group) { - Assert.assertTrue(group != null, "The ContentGroup must not be null"); + Assert.isTrue(group != null, "The ContentGroup must not be null"); set(CONTENT_GROUP, group); } @@ -180,11 +180,11 @@ public class ContentGroupAssociation extends ContentItem { methodName = "swapWithPrevious"; } - Assert.assertTrue(!isNew(), methodName + " cannot be called on an " + + Assert.isTrue(!isNew(), methodName + " cannot be called on an " + "object that is new"); Integer currentKey = (Integer)get(SORT_KEY); - Assert.assertTrue(currentKey != null, methodName + " cannot be " + + Assert.isTrue(currentKey != null, methodName + " cannot be " + "called on an object that is not currently in the " + "list"); diff --git a/ccm-cms/src/com/arsdigita/cms/contenttypes/Link.java b/ccm-cms/src/com/arsdigita/cms/contenttypes/Link.java index eb31a1657..2843f9a54 100755 --- a/ccm-cms/src/com/arsdigita/cms/contenttypes/Link.java +++ b/ccm-cms/src/com/arsdigita/cms/contenttypes/Link.java @@ -165,7 +165,7 @@ public class Link extends ACSObject { * Link.INTERNAL_LINK */ public void setTargetType(String type) { - Assert.assertTrue(type != null && + Assert.isTrue(type != null && (type.equals(EXTERNAL_LINK)||type.equals(INTERNAL_LINK))); set(TARGET_TYPE, type); } @@ -276,7 +276,7 @@ public class Link extends ACSObject { * @param order the link order */ public void setOrder(Integer order) { - Assert.assertNotNull(order); + Assert.exists(order); set(ORDER, order); } @@ -433,7 +433,7 @@ public class Link extends ACSObject { methodName = "swapWithPrevious"; } - Assert.assertTrue(!isNew(), methodName + " cannot be called on an " + + Assert.isTrue(!isNew(), methodName + " cannot be called on an " + "object that is new"); Integer currentKey = (Integer)get(ORDER); @@ -444,7 +444,7 @@ public class Link extends ACSObject { alphabetize(); return; } - Assert.assertTrue(currentKey != null, methodName + " cannot be " + + Assert.isTrue(currentKey != null, methodName + " cannot be " + "called on an object that is not currently in the " + "list"); diff --git a/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/LinkDisplayTable.java b/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/LinkDisplayTable.java index 99635f9d9..6c236b3ad 100755 --- a/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/LinkDisplayTable.java +++ b/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/LinkDisplayTable.java @@ -111,7 +111,7 @@ public class LinkDisplayTable extends LinkTable { private Link getLink(TableActionEvent e) { String id = (String)e.getRowKey(); - Assert.assertNotNull(id); + Assert.exists(id); Link link; try { link = new Link(new BigDecimal(id)); diff --git a/ccm-cms/src/com/arsdigita/cms/dispatcher/ContentItemDispatcher.java b/ccm-cms/src/com/arsdigita/cms/dispatcher/ContentItemDispatcher.java index dd1075ecd..bcabd9eb0 100755 --- a/ccm-cms/src/com/arsdigita/cms/dispatcher/ContentItemDispatcher.java +++ b/ccm-cms/src/com/arsdigita/cms/dispatcher/ContentItemDispatcher.java @@ -99,7 +99,7 @@ public class ContentItemDispatcher implements Dispatcher { final ContentSection section = (ContentSection) Web.getContext().getApplication(); - Assert.assertNotNull(item); + Assert.exists(item); //get the item's template final String sTemplateURL = getTemplatePath(item, request, actx); diff --git a/ccm-cms/src/com/arsdigita/cms/dispatcher/ContentSectionDispatcher.java b/ccm-cms/src/com/arsdigita/cms/dispatcher/ContentSectionDispatcher.java index 925d8f926..77c4ffb72 100755 --- a/ccm-cms/src/com/arsdigita/cms/dispatcher/ContentSectionDispatcher.java +++ b/ccm-cms/src/com/arsdigita/cms/dispatcher/ContentSectionDispatcher.java @@ -105,7 +105,7 @@ public class ContentSectionDispatcher implements Dispatcher { // Fetch the current site node from the request context; SiteNode sn = actx.getSiteNode(); ContentSection section = ContentSection.getSectionFromNode(sn); - Assert.assertNotNull(section); + Assert.exists(section); request.setAttribute(CONTENT_SECTION, section); diff --git a/ccm-cms/src/com/arsdigita/cms/dispatcher/MasterPage.java b/ccm-cms/src/com/arsdigita/cms/dispatcher/MasterPage.java index 61998bdea..335028e41 100755 --- a/ccm-cms/src/com/arsdigita/cms/dispatcher/MasterPage.java +++ b/ccm-cms/src/com/arsdigita/cms/dispatcher/MasterPage.java @@ -56,7 +56,7 @@ public class MasterPage extends CMSPage { public ContentSection getContentSection(HttpServletRequest request) { // Resets all content sections associations. ContentSection section = super.getContentSection(request); - Assert.assertNotNull(section); + Assert.exists(section); return section; } diff --git a/ccm-cms/src/com/arsdigita/cms/dispatcher/MultilingualItemResolver.java b/ccm-cms/src/com/arsdigita/cms/dispatcher/MultilingualItemResolver.java index 6871ad073..7bd3a88bd 100755 --- a/ccm-cms/src/com/arsdigita/cms/dispatcher/MultilingualItemResolver.java +++ b/ccm-cms/src/com/arsdigita/cms/dispatcher/MultilingualItemResolver.java @@ -114,7 +114,7 @@ public class MultilingualItemResolver extends AbstractItemResolver implements It // We allow for returning null, so the root folder may // not be live. - //Assert.assertTrue(rootFolder.isLive(), + //Assert.isTrue(rootFolder.isLive(), // "live context - root folder of secion must be live"); // If the context is 'live', we need the live item. @@ -659,7 +659,7 @@ public class MultilingualItemResolver extends AbstractItemResolver implements It pos++; // skip the "=" - // ID is the string between the equal (at pos) and the next separator + // ID is the string between the isEqual (at pos) and the next separator int i = item_id.indexOf(SEPARATOR); item_id = item_id.substring(pos, Math.min(i, item_id.length() -1)); diff --git a/ccm-cms/src/com/arsdigita/cms/dispatcher/ResourceHandlerImpl.java b/ccm-cms/src/com/arsdigita/cms/dispatcher/ResourceHandlerImpl.java index cd76c7f1b..71b434bdd 100755 --- a/ccm-cms/src/com/arsdigita/cms/dispatcher/ResourceHandlerImpl.java +++ b/ccm-cms/src/com/arsdigita/cms/dispatcher/ResourceHandlerImpl.java @@ -64,7 +64,7 @@ public abstract class ResourceHandlerImpl implements ResourceHandler { public ContentSection getContentSection(HttpServletRequest request) { // resets all content sections associations ContentSection section = CMSDispatcher.getContentSection(request); - Assert.assertNotNull(section); + Assert.exists(section); return section; } diff --git a/ccm-cms/src/com/arsdigita/cms/enterprise.init b/ccm-cms/src/com/arsdigita/cms/enterprise.init index ab09fc9f1..97568f756 100755 --- a/ccm-cms/src/com/arsdigita/cms/enterprise.init +++ b/ccm-cms/src/com/arsdigita/cms/enterprise.init @@ -15,71 +15,6 @@ init com.arsdigita.cms.installer.xml.ContentTypeInitializer { }; } -//-- init com.arsdigita.cms.publishToFile.LegacyInitializer { - // List of publish destinations for content types - // Each element is a four-element list in the format - // '{ "content type", "root directory", "shared storage", - // "url stub" }'. - // "Content type" is the object type of the content type. - // "Root directory" must be a path to a writable directory, relative - // to the file-system root. - // (pboy): "Root directory here is relative to application base! - // "Shared storage" must be _true_ if the root - // directory is shared NFS storage, _false_ otherwise. "URL stub" - // must be the path component of the URL from which the live server - // will serve from this directory. -//-- destination = { -//-- { "com.arsdigita.cms.ContentItem", -//-- "p2fs", -//-- false, -//-- "/p2fs" }, - // (pboy): starting with webapps refers to the CCM_HOME env variable which - // points to the installation root of the servlet container. This is not - // used anymore, all specifications are relative to webapplication base. - // So the following may have to be changed to "packages/content-section/templates" - // if someone tries to use p2fs -//-- { "com.arsdigita.cms.Template", -//-- // "webapps/ROOT/packages/content-section/templates", -//-- "packages/content-section/templates", -//-- false, -//-- "/templates" } -//-- }; - - // Class which implements PublishToFileListener used to perform - // additional actions when publishing or unpublishing to the file system. -//-- publishListener = "com.arsdigita.cms.publishToFile.PublishToFile"; - - // Queue management parameters. - - // Set startupDelay to 0 to disable the processing of the queue - // Time (seconds) before starting to monitor the - // queue after a server start -//-- startupDelay = 30; - - // Time (in seconds) between checking if there are entries in the - // publishToFile queue. - // A value <= 0 disables processing the queue on this server. -//-- pollDelay = 5; - - // Time to wait (seconds) before retrying - // to process a failed entry -//-- retryDelay = 120; - - // Number of queue entries to process at once. -//-- blockSize = 40; - // Number of times a failed queue entry will be - // reprocessed. If processing has failed more than - // that number of times, the entry will be - // ignored. -//-- maximumFailCount = 10; - - // Method used to select entries for processing. - // 'QueuedOrder'-in queued order. - // 'GroupByParent'-group entries according to parent when selecting items - // (allows optimizations if a listener task required for all elements in a folder - // can be done only once for the folder). -//-- blockSelectMethod = "GroupByParent"; -//-- } init com.arsdigita.cms.installer.SectionInitializer { @@ -92,7 +27,8 @@ init com.arsdigita.cms.installer.SectionInitializer { // - Parameter waf.pagemap.login_redirect=content/content-center-redirect.jsp // in integrations.properties of the respective bundle // - registerDomain(navigationKey, "/content/", null); in ldn.aplaws.Loader - name = "content"; +//-- name = "content"; + name = "intern"; // List of roles to create. First field is role name, // second is the description, third is a list of @@ -138,14 +74,20 @@ init com.arsdigita.cms.installer.SectionInitializer { // The types are registered when the content-section is created. Later // modifications have no effect. +//-- types = { +//-- }; types = { + "com.arsdigita.cms.contenttypes.Address", + "com.arsdigita.cms.contenttypes.Article", + "com.arsdigita.cms.contenttypes.Contact" }; // Category tree to load categories = { "/WEB-INF/resources/article-categories.xml", "/WEB-INF/resources/navigation-categories.xml" }; // Wether to make content viewable to 'The Public', ie non-registered users - public = true; +//-- public = true; + public = false; // When to generate email alerts: by default, generate email alerts // on enable, finish, and rollback (happens on rejection) @@ -279,6 +221,147 @@ init com.arsdigita.formbuilder.installer.Initializer { } +//Used when running CMS in conjunction with a Portal +init com.arsdigita.cms.installer.portlet.Initializer {} + + + +// ////////////////////////////////////////////////////////// +// +// Initializer replaced by new initialization system +// +// ////////////////////////////////////////////////////////// + + +// No longer needed, refactored as a sub-initializer of ccm initializer +// (following the new initializer system) + +// init com.arsdigita.cms.publishToFile.LegacyInitializer { +// // List of publish destinations for content types +// // Each element is a four-element list in the format +// // '{ "content type", "root directory", "shared storage", +// // "url stub" }'. +// // "Content type" is the object type of the content type. +// // "Root directory" must be a path to a writable directory, relative +// // to the file-system root. +// // (pboy): "Root directory here is relative to application base! +// // "Shared storage" must be _true_ if the root +// // directory is shared NFS storage, _false_ otherwise. "URL stub" +// // must be the path component of the URL from which the live server +// // will serve from this directory. +// destination = { +// { "com.arsdigita.cms.ContentItem", +// "p2fs", +// false, +// "/p2fs" }, +// // (pboy): starting with webapps refers to the CCM_HOME env variable which +// // points to the installation root of the servlet container. This is not +// // used anymore, all specifications are relative to webapplication base. +// // So the following may have to be changed to "packages/content-section/templates" +// // if someone tries to use p2fs +// { "com.arsdigita.cms.Template", +// // "webapps/ROOT/packages/content-section/templates", +// "packages/content-section/templates", +// false, +// "/templates" } +// }; +// +// // Class which implements PublishToFileListener used to perform +// // additional actions when publishing or unpublishing to the file system. +// publishListener = "com.arsdigita.cms.publishToFile.PublishToFile"; +// +// // Queue management parameters. +// +// // Set startupDelay to 0 to disable the processing of the queue +// // Time (seconds) before starting to monitor the +// // queue after a server start +// startupDelay = 30; +// +// // Time (in seconds) between checking if there are entries in the +// // publishToFile queue. +// // A value <= 0 disables processing the queue on this server. +// pollDelay = 5; +// +// // Time to wait (seconds) before retrying +// // to process a failed entry +// retryDelay = 120; +// +// // Number of queue entries to process at once. +// blockSize = 40; +// // Number of times a failed queue entry will be +// // reprocessed. If processing has failed more than +// // that number of times, the entry will be +// // ignored. +// maximumFailCount = 10; +// +// // Method used to select entries for processing. +// // 'QueuedOrder'-in queued order. +// // 'GroupByParent'-group entries according to parent when selecting items +// // (allows optimizations if a listener task required for all elements in a folder +// // can be done only once for the folder). +// blockSelectMethod = "GroupByParent"; +// } + + +// No longer needed, refactored as a sub-initializer of ccm initializer +// (following the new initializer system) +// +// init com.arsdigita.cms.lifecycle.LegacyInitializer { +// // How long do we wait (in seconds) after system startup +// // before we start processing lifecycles? +// delay = 60; +// // How often (in seconds) does the system look for pending +// // items to make live and live items to expire +// frequency = 600; +// } + + +// This is no longer needed. Item adapters are now set via standard +// initializers. Legacy initializer is still available if you need +// to register multiple adapter files. +//init com.arsdigita.domain.installer.DomainObjectTraversalInitializer { +// adapters = { +// "/WEB-INF/resources/cms-item-adapters.xml" +// }; +// +//} + +// This is no longer needed. +// Initializer com.arsdigita.cms.populate.Initializer no longer part of the +// source code nor exist a package com.arsdigita.cms.populate anymore. +// Had been commented out in rev. 8 (in 2004) + +//populates the database with CMS Content Items and +//other, CMS-related data +// +//You should disable the PublishToFile initializers +//while running this population initializer or set its delay +//long enough so that it won't run until this initializer +//has finished. Also, the content items created by this +//initializer won't be live until the lifeCycle initializers +//have completed running on them. +// +// init com.arsdigita.cms.populate.Initializer { +// contentSection = "content"; +// //total folders created = numTopLevelFolders * folderDepth +// numTopLevelFolders = 3; +// folderDepth = 2; +// numContentItems = 5; +// createContentTypes = +// {"com.arsdigita.cms.populate.CreateArticle", +// "com.arsdigita.cms.populate.CreateTextArticle", +// "com.arsdigita.cms.populate.CreateMultiPartArticle", +// "com.arsdigita.cms.populate.CreateTextMultiPartArticle" +// }; +// numUsers = 10; +// } + + +// This is mot needed for a longtime. +// It has been commented out since revision 473 (Aug. 2005) or earlier +// Had been active in initial aplaws checkin (at rev. 8 about 2004) +// Modified in r473 as a svn:merge of 319-431 + //init com.arsdigita.cms.installer.SectionInitializer { // // Name of the content section (used to form URL) // name = "forms"; @@ -360,64 +443,3 @@ init com.arsdigita.formbuilder.installer.Initializer { // maxAlerts = 5; // //} - -//Used when running CMS in conjunction with a Portal -init com.arsdigita.cms.installer.portlet.Initializer {} - -//populates the database with CMS Content Items and -//other, CMS-related data -// -//You should disable the PublishToFile initializers -//while running this population initializer or set its delay -//long enough so that it won't run until this initializer -//has finished. Also, the content items created by this -//initializer won't be live until the lifeCycle initializers -//have completed running on them. -// -// init com.arsdigita.cms.populate.Initializer { -// contentSection = "content"; -// //total folders created = numTopLevelFolders * folderDepth -// numTopLevelFolders = 3; -// folderDepth = 2; -// numContentItems = 5; -// createContentTypes = -// {"com.arsdigita.cms.populate.CreateArticle", -// "com.arsdigita.cms.populate.CreateTextArticle", -// "com.arsdigita.cms.populate.CreateMultiPartArticle", -// "com.arsdigita.cms.populate.CreateTextMultiPartArticle" -// }; -// numUsers = 10; -// } - - - -// ////////////////////////////////////////////////////////// -// -// Initializer replaced by new initialization system -// -// ////////////////////////////////////////////////////////// - - -// No longer needed, refactored as a sub-initializer of ccm initializer -// (following the new initializer system) -// -// init com.arsdigita.cms.lifecycle.LegacyInitializer { -// // How long do we wait (in seconds) after system startup -// // before we start processing lifecycles? -// delay = 60; -// // How often (in seconds) does the system look for pending -// // items to make live and live items to expire -// frequency = 600; -// } - - -// This is no longer needed. Item adapters are now set via standard -// initializers. Legacy initializer is still available if you need -// to register multiple adapter files. -//init com.arsdigita.domain.installer.DomainObjectTraversalInitializer { -// adapters = { -// "/WEB-INF/resources/cms-item-adapters.xml" -// }; -// -//} - diff --git a/ccm-cms/src/com/arsdigita/cms/installer/xml/ContentBundleHelper.java b/ccm-cms/src/com/arsdigita/cms/installer/xml/ContentBundleHelper.java index 3b021f5d7..da80a63d6 100755 --- a/ccm-cms/src/com/arsdigita/cms/installer/xml/ContentBundleHelper.java +++ b/ccm-cms/src/com/arsdigita/cms/installer/xml/ContentBundleHelper.java @@ -172,7 +172,7 @@ s_log.warn ( "Created bundled Item: " + getName() + " " + m_item ); clone.save(); cloneBundle.save(); } - Assert.assertNotNull(clone); + Assert.exists(clone); return clone; } } diff --git a/ccm-cms/src/com/arsdigita/cms/installer/xml/ContentItemHelper.java b/ccm-cms/src/com/arsdigita/cms/installer/xml/ContentItemHelper.java index 063d2652d..59048f11d 100755 --- a/ccm-cms/src/com/arsdigita/cms/installer/xml/ContentItemHelper.java +++ b/ccm-cms/src/com/arsdigita/cms/installer/xml/ContentItemHelper.java @@ -202,7 +202,7 @@ public class ContentItemHelper { save(); } - Assert.assertNotNull(m_item); + Assert.exists(m_item); s_log.debug ( "Successfully created content item"); return m_item; } @@ -242,15 +242,15 @@ public class ContentItemHelper { throw new UncheckedWrapperException (e); } - Assert.assertNotNull ( l_item ); + Assert.exists ( l_item ); return l_item; } /* Only call this method after create() has been called. */ public void set(String methodName, String argClass, String value) { - Assert.assertNotNull(m_item); - Assert.assertNotNull(m_contentTypeClass); + Assert.exists(m_item); + Assert.exists(m_contentTypeClass); if (methodName != null ) { s_log.debug("setting property with : " + methodName ); } @@ -267,7 +267,7 @@ public class ContentItemHelper { if (methodName != null || argClass != null || value != null ) { try { - Assert.assertNotNull(argClass); + Assert.exists(argClass); Class[] args = {Class.forName(argClass)}; s_log.debug("npe2?"); Method method = m_contentTypeClass.getMethod(methodName, args); @@ -319,7 +319,7 @@ public class ContentItemHelper { * Look for ContentItems with the same name */ protected ContentItem getContentItemByName(String name, Folder parent) { - Assert.assertNotNull(parent); + Assert.exists(parent); // Also check that there aren't any duplicates ContentItem item = null; ItemCollection items = parent.getItems(); @@ -349,7 +349,7 @@ public class ContentItemHelper { } protected ContentItem cloneItem(int count, Folder parent, boolean save) { - Assert.assertNotNull(m_item); + Assert.exists(m_item); final String name = m_item.getName() + "_" + count; return cloneItem(name, parent, save); @@ -366,7 +366,7 @@ public class ContentItemHelper { if (save) { clone.save(); } - Assert.assertNotNull(clone); + Assert.exists(clone); return clone; } @@ -394,7 +394,7 @@ public class ContentItemHelper { * the ContentItem and the parameter count

*/ public String cloneName ( int count ) { - Assert.assertNotNull(m_item); + Assert.exists(m_item); return m_item.getName() + "_" + count; } } diff --git a/ccm-cms/src/com/arsdigita/cms/lifecycle/Duration.java b/ccm-cms/src/com/arsdigita/cms/lifecycle/Duration.java index 8ea97429d..602e443f8 100755 --- a/ccm-cms/src/com/arsdigita/cms/lifecycle/Duration.java +++ b/ccm-cms/src/com/arsdigita/cms/lifecycle/Duration.java @@ -36,7 +36,7 @@ public class Duration { * @pre minutes != null */ public static String formatDuration(Integer minutes) { - Assert.assertNotNull(minutes, "minutes"); + Assert.exists(minutes, "minutes"); return formatDuration(minutes.intValue()); } @@ -105,7 +105,7 @@ public class Duration { } private static Integer[] copyArray(int[] from) { - Assert.assertNotNull(from, "from"); + Assert.exists(from, "from"); Integer[] to = new Integer[from.length]; for (int ii=0; ii 0, "Timeout must be > than 0."); + Assert.isTrue(timeout > 0, "Timeout must be > than 0."); m_timeout = timeout; } diff --git a/ccm-cms/src/com/arsdigita/cms/publishToFile/LinkScanner.java b/ccm-cms/src/com/arsdigita/cms/publishToFile/LinkScanner.java index c9b75ff53..9265639c9 100755 --- a/ccm-cms/src/com/arsdigita/cms/publishToFile/LinkScanner.java +++ b/ccm-cms/src/com/arsdigita/cms/publishToFile/LinkScanner.java @@ -117,7 +117,7 @@ class LinkScanner { private TagRef[] m_tags; public LinkScanner(String html) { - Assert.assertNotNull(html); + Assert.exists(html); m_content = html; m_tags = parse(); } diff --git a/ccm-cms/src/com/arsdigita/cms/publishToFile/PublishToFile.java b/ccm-cms/src/com/arsdigita/cms/publishToFile/PublishToFile.java index 6df7cc98c..ec904b1fd 100755 --- a/ccm-cms/src/com/arsdigita/cms/publishToFile/PublishToFile.java +++ b/ccm-cms/src/com/arsdigita/cms/publishToFile/PublishToFile.java @@ -181,7 +181,7 @@ public class PublishToFile implements PublishToFileListener { public static URL getSource(final String path) { if (Assert.isEnabled()) { Assert.exists(path, String.class); - Assert.truth(path.startsWith("/"), "Path starts with '/'"); + Assert.isTrue(path.startsWith("/"), "Path starts with '/'"); } final WebConfig config = Web.getConfig(); @@ -279,7 +279,7 @@ public class PublishToFile implements PublishToFileListener { s_log.warn( "Item to publish no longer exists. ID = " + qe.getItemId() ); return false; } - Assert.assertTrue( !(item instanceof ContentBundle) ); + Assert.isTrue( !(item instanceof ContentBundle) ); if ( item instanceof Template ) { Template template = (Template) item; @@ -298,7 +298,7 @@ public class PublishToFile implements PublishToFileListener { // 'destination' for the Template object type, so we must // strip it off here, otherwise it gets double appended String templateRoot = ContentSection.getConfig().getTemplateRoot(); - Assert.truth(fileName.startsWith(templateRoot), + Assert.isTrue(fileName.startsWith(templateRoot), "filename starts with templateRoot"); PublishedFile f = PublishedFile.loadOrCreate( @@ -575,7 +575,7 @@ public class PublishToFile implements PublishToFileListener { * publish asset (such as an image) to file system. */ private void writeAsset(Asset asset, PublishedFile f) { - Assert.assertTrue(ContentItem.LIVE.equals(asset.getVersion())); + Assert.isTrue(ContentItem.LIVE.equals(asset.getVersion())); File fsf = f.getFile(); try { @@ -603,7 +603,7 @@ public class PublishToFile implements PublishToFileListener { } else { itemPath = Utilities.getItemLocation(target); } - Assert.truth(itemPath.startsWith("/"), "item path starts with /"); + Assert.isTrue(itemPath.startsWith("/"), "item path starts with /"); DestinationStub stub = PublishToFile.getDestination(target.getSpecificObjectType()); String stubURL = stub.getURLStub(); diff --git a/ccm-cms/src/com/arsdigita/cms/publishToFile/PublishedFile.java b/ccm-cms/src/com/arsdigita/cms/publishToFile/PublishedFile.java index a0a539113..5c7988aa7 100755 --- a/ccm-cms/src/com/arsdigita/cms/publishToFile/PublishedFile.java +++ b/ccm-cms/src/com/arsdigita/cms/publishToFile/PublishedFile.java @@ -147,7 +147,7 @@ class PublishedFile extends DomainObject { File path = new File(fileName).getParentFile(); File p = f.getParentFile(); do { - Assert.assertTrue(p.isDirectory()); + Assert.isTrue(p.isDirectory()); DataCollection coll = SessionManager.getSession() .retrieve(BASE_DATA_OBJECT_TYPE); coll.addEqualsFilter(HOST + "." + Host.ID, host.getID()); @@ -177,10 +177,10 @@ class PublishedFile extends DomainObject { public static PublishedFile create(ContentItem item, String fileName, Host host) { - Assert.truth(item != null, "item is not null"); - Assert.truth(item.isLive(), "item is live"); - Assert.truth(fileName != null, "fileName is not null"); - Assert.truth(host != null, "host is not null"); + Assert.isTrue(item != null, "item is not null"); + Assert.isTrue(item.isLive(), "item is live"); + Assert.isTrue(fileName != null, "fileName is not null"); + Assert.isTrue(host != null, "host is not null"); if (s_log.isDebugEnabled()) { s_log.debug("creating published file with item " + item.getOID() + @@ -209,10 +209,10 @@ class PublishedFile extends DomainObject { static PublishedFile loadOrCreate(ContentItem item, String fileName, Host host) { - Assert.truth(item != null, "item is not null"); - Assert.truth(item.isLive(), "item is live"); - Assert.truth(fileName != null, "fileName is not null"); - Assert.truth(host != null, "host is not null"); + Assert.isTrue(item != null, "item is not null"); + Assert.isTrue(item.isLive(), "item is live"); + Assert.isTrue(fileName != null, "fileName is not null"); + Assert.isTrue(host != null, "host is not null"); PublishedFile f = findByFileName(fileName, host); if (f == null) { diff --git a/ccm-cms/src/com/arsdigita/cms/publishToFile/QueueEntry.java b/ccm-cms/src/com/arsdigita/cms/publishToFile/QueueEntry.java index 2f2f487f7..3c26504ca 100755 --- a/ccm-cms/src/com/arsdigita/cms/publishToFile/QueueEntry.java +++ b/ccm-cms/src/com/arsdigita/cms/publishToFile/QueueEntry.java @@ -190,7 +190,7 @@ public class QueueEntry extends DomainObject { ContentItem result = Utilities.getContentItemOrNull(getItemId()); // FIXME: We need to exempt move tasks from the ContainerItem // assertion, since moves can have anything as the item [lutter] - Assert.assertTrue(TASK_MOVE.equals(getTask()) + Assert.isTrue(TASK_MOVE.equals(getTask()) || ! (result instanceof ContentBundle), "The item for a task must not be a ContentBundle"); return result; @@ -221,7 +221,7 @@ public class QueueEntry extends DomainObject { */ public ContentItem getParent() { ContentItem result = Utilities.getContentItemOrNull(getParentId()); - Assert.assertTrue(result == null || (result instanceof ContentBundle) ); + Assert.isTrue(result == null || (result instanceof ContentBundle) ); return result; } diff --git a/ccm-cms/src/com/arsdigita/cms/publishToFile/Utilities.java b/ccm-cms/src/com/arsdigita/cms/publishToFile/Utilities.java index ed3262e00..2622ecfc5 100755 --- a/ccm-cms/src/com/arsdigita/cms/publishToFile/Utilities.java +++ b/ccm-cms/src/com/arsdigita/cms/publishToFile/Utilities.java @@ -84,7 +84,7 @@ public class Utilities { ***/ static String getItemURL(ContentItem item) { - Assert.assertNotNull(item); + Assert.exists(item); ContentSection section = item.getContentSection(); ContentItem working = item.getWorkingVersion(); @@ -127,7 +127,7 @@ public class Utilities { */ public static boolean moveItem( Folder dstFolder, Folder srcFolder, ContentItem item ) { if (Assert.isEnabled()) { - Assert.assertTrue(item != null && srcFolder != null && dstFolder != null); + Assert.isTrue(item != null && srcFolder != null && dstFolder != null); } final Host host = Host.retrieve(Web.getConfig().getHost()); @@ -136,7 +136,7 @@ public class Utilities { // into PublishedFile [lutter] String dst = validateLocation(dstFolder, true); if ( item instanceof ContentBundle ) { - Assert.assertTrue(!Folder.INDEX.equals(item.getName()), "don't pass ContentBundle as Index Item, better to pass Folder"); + Assert.isTrue(!Folder.INDEX.equals(item.getName()), "don't pass ContentBundle as Index Item, better to pass Folder"); moveBundle((ContentBundle)item, dst, host); } else { String path = item.getPath(); @@ -144,9 +144,9 @@ public class Utilities { return false; ContentSection section = item.getContentSection(); - Assert.assertNotNull(section); + Assert.exists(section); path = PublishToFile.stripSourceBase(section.getURL() + path); - Assert.assertTrue(path != null && path.length() > 0); + Assert.isTrue(path != null && path.length() > 0); File root = PublishToFile.getDestination(item.getSpecificObjectType()).getFile(); String src = new File(root, path).getAbsolutePath(); @@ -183,7 +183,7 @@ public class Utilities { private static void moveItem(ContentItem item, String dstPath, Host host) { - Assert.assertTrue(ContentItem.LIVE.equals(item.getVersion()), "ContentItem item = " + item + " is not a live version"); + Assert.isTrue(ContentItem.LIVE.equals(item.getVersion()), "ContentItem item = " + item + " is not a live version"); String docRoot = PublishToFile.getDestination(item.getSpecificObjectType()).getFile().getAbsolutePath(); DataQuery query = SessionManager.getSession().retrieveQuery("com.arsdigita.cms.publishToFile.getRelatedFiles"); @@ -191,7 +191,7 @@ public class Utilities { query.setParameter("hostId", host.getID()); while ( query.next() ) { String fileName = (String)query.get("fileName"); - Assert.assertNotNull(fileName); + Assert.exists(fileName); fileName = docRoot + fileName; String cmd = "/bin/mv -f " + fileName + " " + dstPath; // s_log.debug("Moving item: source " + fileName + ", destination " + dstPath); @@ -211,7 +211,7 @@ public class Utilities { Folder srcFolder, Folder dstFolder, Host host) { - Assert.assertTrue(ContentItem.LIVE.equals(item.getVersion()) && + Assert.isTrue(ContentItem.LIVE.equals(item.getVersion()) && ContentItem.LIVE.equals(srcFolder.getVersion()) && ContentItem.LIVE.equals(dstFolder.getVersion()) ); @@ -273,7 +273,7 @@ public class Utilities { * @return validated folder path if successed, othervise returns empty string */ private static String validateLocation(Folder folder, boolean makeNew) { - Assert.assertNotNull(folder); + Assert.exists(folder); String fullPath = getItemFullPath(folder); try { File file = new File(fullPath); @@ -308,9 +308,9 @@ public class Utilities { if (path == null || path.equals("")) return; ContentSection section = item.getContentSection(); - Assert.assertNotNull(section); + Assert.exists(section); path = PublishToFile.stripSourceBase(section.getURL() + path); - Assert.assertTrue(path != null && path.length() > 0); + Assert.isTrue(path != null && path.length() > 0); path = '/' + path; DataOperation operation = SessionManager.getSession(). @@ -337,12 +337,12 @@ public class Utilities { * @return Full path of an items on FS */ public static String getItemFullPath(ContentItem item) { - Assert.assertNotNull(item); + Assert.exists(item); File root = PublishToFile.getDestination(item.getSpecificObjectType()).getFile(); String location = getItemLocation(item); - Assert.assertNotNull(location); - Assert.assertTrue(location.startsWith("/")); + Assert.exists(location); + Assert.isTrue(location.startsWith("/")); return new File(root, location).getAbsolutePath(); } @@ -375,7 +375,7 @@ public class Utilities { * @return The corresponding content item. ***/ public static ContentItem getContentItem(BigDecimal itemID) { - Assert.assertNotNull(itemID, "You passed null as Item ID"); + Assert.exists(itemID, "You passed null as Item ID"); ContentItem item; OID oid = new OID(ContentItem.BASE_DATA_OBJECT_TYPE, itemID); try { @@ -477,8 +477,8 @@ public class Utilities { */ // FIXME: This should be done in the MoveItemCommand [lutter] public static void updateContentSection(ContentItem item, ContentSection newSection) { - Assert.assertNotNull(item); - Assert.assertNotNull(newSection); + Assert.exists(item); + Assert.exists(newSection); ContentSection oldSection = item.getContentSection(); diff --git a/ccm-cms/src/com/arsdigita/cms/ui/ArticleImageDisplay.java b/ccm-cms/src/com/arsdigita/cms/ui/ArticleImageDisplay.java index a170c3b06..d9497fb31 100755 --- a/ccm-cms/src/com/arsdigita/cms/ui/ArticleImageDisplay.java +++ b/ccm-cms/src/com/arsdigita/cms/ui/ArticleImageDisplay.java @@ -77,7 +77,7 @@ public class ArticleImageDisplay extends ImageDisplay { */ protected Article getArticle(PageState state) { Article article = (Article) m_article.getSelectedObject(state); - Assert.assertNotNull(article, "Article"); + Assert.exists(article, "Article"); return article; } diff --git a/ccm-cms/src/com/arsdigita/cms/ui/BaseForm.java b/ccm-cms/src/com/arsdigita/cms/ui/BaseForm.java index 60e055c48..d4d25de02 100755 --- a/ccm-cms/src/com/arsdigita/cms/ui/BaseForm.java +++ b/ccm-cms/src/com/arsdigita/cms/ui/BaseForm.java @@ -153,7 +153,7 @@ public abstract class BaseForm extends Form final int maxLength, final boolean isRequired) { super(new TrimmedStringParameter(key)); - Assert.truth(maxLength > 0, "Max length cannot be negative"); + Assert.isTrue(maxLength > 0, "Max length cannot be negative"); if (isRequired) { addValidationListener(NotNullValidationListener.DEFAULT); diff --git a/ccm-cms/src/com/arsdigita/cms/ui/BrowsePane.java b/ccm-cms/src/com/arsdigita/cms/ui/BrowsePane.java index a4b11f93f..96ef96da5 100755 --- a/ccm-cms/src/com/arsdigita/cms/ui/BrowsePane.java +++ b/ccm-cms/src/com/arsdigita/cms/ui/BrowsePane.java @@ -166,7 +166,7 @@ public class BrowsePane extends LayoutPanel implements Resettable { final PageState state = e.getPageState(); if (Assert.isEnabled()) { - Assert.truth(m_model.isSelected(state)); + Assert.isTrue(m_model.isSelected(state)); } final Folder root = CMS.getContext().getContentSection diff --git a/ccm-cms/src/com/arsdigita/cms/ui/ContentItemPage.java b/ccm-cms/src/com/arsdigita/cms/ui/ContentItemPage.java index 61e9ce6e0..67f12d3be 100755 --- a/ccm-cms/src/com/arsdigita/cms/ui/ContentItemPage.java +++ b/ccm-cms/src/com/arsdigita/cms/ui/ContentItemPage.java @@ -311,7 +311,7 @@ public class ContentItemPage extends CMSPage implements ActionListener { public ContentSection getContentSection(HttpServletRequest request) { // Resets all content sections associations. ContentSection section = super.getContentSection(request); - Assert.assertNotNull(section); + Assert.exists(section); return section; } diff --git a/ccm-cms/src/com/arsdigita/cms/ui/ContentPageTable.java b/ccm-cms/src/com/arsdigita/cms/ui/ContentPageTable.java index ba2f99054..a4b6d753b 100755 --- a/ccm-cms/src/com/arsdigita/cms/ui/ContentPageTable.java +++ b/ccm-cms/src/com/arsdigita/cms/ui/ContentPageTable.java @@ -132,7 +132,7 @@ public class ContentPageTable extends DataTable { * {@link ContentItem#DRAFT} or {@link ContentItem#LIVE} */ public void setContext(String context) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); m_context = context; } @@ -144,7 +144,7 @@ public class ContentPageTable extends DataTable { * will be shown */ public void setContentType(ContentType c) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); m_type = c; } diff --git a/ccm-cms/src/com/arsdigita/cms/ui/ContentSectionPage.java b/ccm-cms/src/com/arsdigita/cms/ui/ContentSectionPage.java index 4a5ff5c80..b219c702b 100755 --- a/ccm-cms/src/com/arsdigita/cms/ui/ContentSectionPage.java +++ b/ccm-cms/src/com/arsdigita/cms/ui/ContentSectionPage.java @@ -383,7 +383,7 @@ public class ContentSectionPage extends CMSPage implements ActionListener { public ContentSection getContentSection(HttpServletRequest request) { // Resets all content sections associations. ContentSection section = super.getContentSection(request); - Assert.assertNotNull(section); + Assert.exists(section); return section; } diff --git a/ccm-cms/src/com/arsdigita/cms/ui/DefaultImageBrowserModelBuilder.java b/ccm-cms/src/com/arsdigita/cms/ui/DefaultImageBrowserModelBuilder.java index 82a67f41a..9cdf1a386 100755 --- a/ccm-cms/src/com/arsdigita/cms/ui/DefaultImageBrowserModelBuilder.java +++ b/ccm-cms/src/com/arsdigita/cms/ui/DefaultImageBrowserModelBuilder.java @@ -104,7 +104,7 @@ public class DefaultImageBrowserModelBuilder extends LockableImpl * {@link ContentItem#DRAFT} or {@link ContentItem#LIVE} */ public void setContext(String context) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); m_context = context; } diff --git a/ccm-cms/src/com/arsdigita/cms/ui/DomainObjectRenderer.java b/ccm-cms/src/com/arsdigita/cms/ui/DomainObjectRenderer.java index b53376245..b3d0f55bc 100755 --- a/ccm-cms/src/com/arsdigita/cms/ui/DomainObjectRenderer.java +++ b/ccm-cms/src/com/arsdigita/cms/ui/DomainObjectRenderer.java @@ -144,7 +144,7 @@ public class DomainObjectRenderer extends SimpleContainer { * the generated XML will be. */ public void setDepth(int depth) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); m_depth = depth; } @@ -160,7 +160,7 @@ public class DomainObjectRenderer extends SimpleContainer { * @pre model != null */ public void setSelectionModel(DomainObjectSelectionModel model) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); m_model = model; } diff --git a/ccm-cms/src/com/arsdigita/cms/ui/FlatItemList.java b/ccm-cms/src/com/arsdigita/cms/ui/FlatItemList.java index dd88366e6..aff1c778f 100755 --- a/ccm-cms/src/com/arsdigita/cms/ui/FlatItemList.java +++ b/ccm-cms/src/com/arsdigita/cms/ui/FlatItemList.java @@ -329,7 +329,7 @@ public class FlatItemList extends SegmentedPanel private void showHideSegments(PageState state) { SecurityManager sm = Utilities.getSecurityManager(state); Folder folder = m_folder.getFolder(state); - Assert.assertNotNull(folder); + Assert.exists(folder); // MP: This should be checked on the current folder instead of just // the content section. diff --git a/ccm-cms/src/com/arsdigita/cms/ui/ImageDisplay.java b/ccm-cms/src/com/arsdigita/cms/ui/ImageDisplay.java index fc60f8ef6..c0b5a0170 100755 --- a/ccm-cms/src/com/arsdigita/cms/ui/ImageDisplay.java +++ b/ccm-cms/src/com/arsdigita/cms/ui/ImageDisplay.java @@ -111,7 +111,7 @@ public class ImageDisplay extends SimpleComponent { protected ImageAsset getImageAsset(PageState state) { ImageAsset image = (ImageAsset) m_item.getSelectedObject(state); - Assert.assertNotNull(image, "Image asset"); + Assert.exists(image, "Image asset"); return image; } diff --git a/ccm-cms/src/com/arsdigita/cms/ui/PartySearchForm.java b/ccm-cms/src/com/arsdigita/cms/ui/PartySearchForm.java index 16c6ea07f..3f5fdf116 100755 --- a/ccm-cms/src/com/arsdigita/cms/ui/PartySearchForm.java +++ b/ccm-cms/src/com/arsdigita/cms/ui/PartySearchForm.java @@ -58,7 +58,7 @@ public class PartySearchForm extends BaseForm { public final void register(final Page page) { super.register(page); - Assert.assertTrue(page.stateContains(this)); + Assert.isTrue(page.stateContains(this)); } public TextField getSearchWidget() { diff --git a/ccm-cms/src/com/arsdigita/cms/ui/SecurityPropertyEditor.java b/ccm-cms/src/com/arsdigita/cms/ui/SecurityPropertyEditor.java index 240dbc4e5..db98d10ae 100755 --- a/ccm-cms/src/com/arsdigita/cms/ui/SecurityPropertyEditor.java +++ b/ccm-cms/src/com/arsdigita/cms/ui/SecurityPropertyEditor.java @@ -72,7 +72,7 @@ public class SecurityPropertyEditor extends PropertyEditor { /** * Construct a new, empty PropertyEditor. The {@link * #setDisplayComponent(Component)} method must be called before this - * component is locked. + * component is isLocked. */ public SecurityPropertyEditor() { this(null); @@ -130,10 +130,10 @@ public class SecurityPropertyEditor extends PropertyEditor { * @pre access.getComponent() == m_forms.get(key) */ public void setComponentAccess(String key, ComponentAccess access) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); Component c = getComponent(key); - Assert.assertNotNull(c, "the specified component"); - Assert.assertTrue(access.getComponent().equals(c), + Assert.exists(c, "the specified component"); + Assert.isTrue(access.getComponent().equals(c), "The specified component does not match the component that" + " id already in the PropertyEditor"); m_accessChecks.put(key, access); diff --git a/ccm-cms/src/com/arsdigita/cms/ui/SortableList.java b/ccm-cms/src/com/arsdigita/cms/ui/SortableList.java index 7743d76dc..32dc4517d 100755 --- a/ccm-cms/src/com/arsdigita/cms/ui/SortableList.java +++ b/ccm-cms/src/com/arsdigita/cms/ui/SortableList.java @@ -108,7 +108,7 @@ public abstract class SortableList extends List { item.addAttribute("configure", "true"); } String key = m.getKey(); - Assert.assertNotNull(key); + Assert.exists(key); // Converting both keys to String for comparison // since ListModel.getKey returns a String diff --git a/ccm-cms/src/com/arsdigita/cms/ui/TasksPanel.java b/ccm-cms/src/com/arsdigita/cms/ui/TasksPanel.java index c89dca662..db25112b4 100755 --- a/ccm-cms/src/com/arsdigita/cms/ui/TasksPanel.java +++ b/ccm-cms/src/com/arsdigita/cms/ui/TasksPanel.java @@ -416,7 +416,7 @@ public class TasksPanel extends CMSContainer { protected BigDecimal getRootFolderID(PageState s) { ContentSection sec = (ContentSection) m_sectionSel.getSelectedObject(s); - Assert.assertNotNull(sec); + Assert.exists(sec); User user = Web.getContext().getUser(); if ( user != null ) { @@ -656,7 +656,7 @@ public class TasksPanel extends CMSContainer { if (taskType.equals(CMSTaskType.DEPLOY) ) { tabNumber = ContentItemPage.PUBLISHING_TAB; } else { - // see if item is locked; if not, lock + // see if item is isLocked; if not, lock if ( !task.isLocked() ) { task.lock(user); } diff --git a/ccm-cms/src/com/arsdigita/cms/ui/authoring/ArticleImage.java b/ccm-cms/src/com/arsdigita/cms/ui/authoring/ArticleImage.java index 82179c1e8..eaf2e4131 100755 --- a/ccm-cms/src/com/arsdigita/cms/ui/authoring/ArticleImage.java +++ b/ccm-cms/src/com/arsdigita/cms/ui/authoring/ArticleImage.java @@ -416,13 +416,13 @@ public class ArticleImage extends SimpleContainer implements AuthoringStepCompon private ImageAsset getImageAsset(PageState state) { ImageAsset image = (ImageAsset) m_assetsWithImage.getSelectedObject(state); - Assert.assertNotNull(image, "Image asset"); + Assert.exists(image, "Image asset"); return image; } private Article getArticle(PageState state) { Article article = (Article) m_articleWithImage.getSelectedObject(state); - Assert.assertNotNull(article, "Article"); + Assert.exists(article, "Article"); return article; } diff --git a/ccm-cms/src/com/arsdigita/cms/ui/authoring/AuthoringKitWizard.java b/ccm-cms/src/com/arsdigita/cms/ui/authoring/AuthoringKitWizard.java index 59187a013..97f8f486f 100755 --- a/ccm-cms/src/com/arsdigita/cms/ui/authoring/AuthoringKitWizard.java +++ b/ccm-cms/src/com/arsdigita/cms/ui/authoring/AuthoringKitWizard.java @@ -236,8 +236,8 @@ public class AuthoringKitWizard extends LayoutPanel implements Resettable { final AuthoringStepCollection steps = m_kit.getSteps(); - if (Assert.isAssertEnabled()) { - Assert.assertTrue(!steps.isEmpty(), + if (Assert.isEnabled()) { + Assert.isTrue(!steps.isEmpty(), "The authoring kit for " + type.getID() + " " + "(java class " + type.getClassName() + ") " + "has no steps."); diff --git a/ccm-cms/src/com/arsdigita/cms/ui/authoring/BasicPageForm.java b/ccm-cms/src/com/arsdigita/cms/ui/authoring/BasicPageForm.java index 3a2b82b06..7b9af7ef7 100755 --- a/ccm-cms/src/com/arsdigita/cms/ui/authoring/BasicPageForm.java +++ b/ccm-cms/src/com/arsdigita/cms/ui/authoring/BasicPageForm.java @@ -110,7 +110,7 @@ public abstract class BasicPageForm extends BasicItemForm { * ItemSelectionModel */ public ContentPage initBasicWidgets(FormSectionEvent e) { - Assert.assertNotNull(getItemSelectionModel()); + Assert.exists(getItemSelectionModel()); FormData data = e.getFormData(); PageState state = e.getPageState(); @@ -142,7 +142,7 @@ public abstract class BasicPageForm extends BasicItemForm { * process listener */ public ContentPage processBasicWidgets(FormSectionEvent e) { - Assert.assertNotNull(getItemSelectionModel()); + Assert.exists(getItemSelectionModel()); FormData data = e.getFormData(); PageState state = e.getPageState(); @@ -176,7 +176,7 @@ public abstract class BasicPageForm extends BasicItemForm { throws FormProcessException { ItemSelectionModel m = getItemSelectionModel(); - Assert.assertNotNull(m); + Assert.exists(m); ContentPage item = null; diff --git a/ccm-cms/src/com/arsdigita/cms/ui/authoring/ItemCategoryStep.java b/ccm-cms/src/com/arsdigita/cms/ui/authoring/ItemCategoryStep.java index e64eb5789..0bf80d138 100755 --- a/ccm-cms/src/com/arsdigita/cms/ui/authoring/ItemCategoryStep.java +++ b/ccm-cms/src/com/arsdigita/cms/ui/authoring/ItemCategoryStep.java @@ -82,7 +82,7 @@ public class ItemCategoryStep extends SimpleContainer m_extensionForms = extension.getForm(); int nSummaries = m_extensionSummaries.length; int nForms= m_extensionForms.length; - Assert.truth(nSummaries==nForms, "invalid CategoryStep extension"); + Assert.isTrue(nSummaries==nForms, "invalid CategoryStep extension"); m_extensionsCount = nForms; for (int i=0;i * * + * @version $Id: BaseLink.java 998 2005-11-15 22:27:13Z sskracic $ */ public abstract class BaseLink extends TextStylable implements Cloneable { - public static final String versionId = "$Id: BaseLink.java 998 2005-11-15 22:27:13Z sskracic $ by $Author: sskracic $, $DateTime: 2004/08/16 18:10:38 $"; - /** * The name of the attribute used in XML to indicate which type of link * this link represents. @@ -193,7 +192,7 @@ public abstract class BaseLink extends TextStylable } public void setChild(Component child) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); m_child = child; } @@ -202,7 +201,7 @@ public abstract class BaseLink extends TextStylable } public final void setTarget(String url) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); m_url = url; } @@ -213,7 +212,7 @@ public abstract class BaseLink extends TextStylable * @param t the type of link */ protected void setTypeAttr(String t) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); setAttribute(TYPE_ATTR, t); } @@ -333,7 +332,7 @@ public abstract class BaseLink extends TextStylable //should not use this method to set confirmation messages--should //use setConfirmation() instead, or else the javascript will break if (value != null) { - Assert.assertTrue(!value.toLowerCase().startsWith("return confirm("), + Assert.isTrue(!value.toLowerCase().startsWith("return confirm("), "Do not use setOnClick() to set confirmation messages. " + "Use setCofirmation() instead."); } @@ -361,9 +360,9 @@ public abstract class BaseLink extends TextStylable //make sure that the message doesn't have any apostrophe's //or back slashes - if (Assert.isAssertEnabled()) { + if (Assert.isEnabled()) { final boolean isGoodMessage = message.indexOf("'") == -1 && message.indexOf("\\") == -1; - Assert.assertTrue(isGoodMessage, + Assert.isTrue(isGoodMessage, "confirmation message cannot contain apostrophe or back slash"); } @@ -376,7 +375,7 @@ public abstract class BaseLink extends TextStylable } public final void setNoJavascriptTarget(String sURL) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); m_noJavascriptURL = sURL; } diff --git a/ccm-core/src/com/arsdigita/bebop/BasePage.java b/ccm-core/src/com/arsdigita/bebop/BasePage.java index 8b17e3363..152c044bb 100755 --- a/ccm-core/src/com/arsdigita/bebop/BasePage.java +++ b/ccm-core/src/com/arsdigita/bebop/BasePage.java @@ -42,7 +42,7 @@ public class BasePage extends Page { String id) { super(title, new SimpleContainer()); - Assert.assertNotNull(application, "application name"); + Assert.exists(application, "application name"); setAttribute("application", application); if (id != null) { diff --git a/ccm-core/src/com/arsdigita/bebop/Bebop.java b/ccm-core/src/com/arsdigita/bebop/Bebop.java index 9d8ec7b63..d952de0f9 100755 --- a/ccm-core/src/com/arsdigita/bebop/Bebop.java +++ b/ccm-core/src/com/arsdigita/bebop/Bebop.java @@ -23,12 +23,9 @@ import org.apache.log4j.Logger; /** * @author Justin Ross * @see com.arsdigita.bebop.BebopConfig + * @version $Id: Bebop.java 287 2005-02-22 00:29:02Z sskracic $ */ public final class Bebop { - public static final String versionId = - "$Id: Bebop.java 287 2005-02-22 00:29:02Z sskracic $" + - "$Author: sskracic $" + - "$DateTime: 2004/08/16 18:10:38 $"; private static final Logger s_log = Logger.getLogger(Bebop.class); diff --git a/ccm-core/src/com/arsdigita/bebop/BebopApplicationServlet.java b/ccm-core/src/com/arsdigita/bebop/BebopApplicationServlet.java.nolongerInUse similarity index 100% rename from ccm-core/src/com/arsdigita/bebop/BebopApplicationServlet.java rename to ccm-core/src/com/arsdigita/bebop/BebopApplicationServlet.java.nolongerInUse diff --git a/ccm-core/src/com/arsdigita/bebop/BebopConfig.java b/ccm-core/src/com/arsdigita/bebop/BebopConfig.java index 1efd8f35c..908783057 100755 --- a/ccm-core/src/com/arsdigita/bebop/BebopConfig.java +++ b/ccm-core/src/com/arsdigita/bebop/BebopConfig.java @@ -34,12 +34,9 @@ import org.apache.log4j.Logger; /** * @author Justin Ross * @see com.arsdigita.bebop.Bebop + * @version $Id: BebopConfig.java 1498 2007-03-19 16:22:15Z apevec $ */ public final class BebopConfig extends AbstractConfig { - public static final String versionId = - "$Id: BebopConfig.java 1498 2007-03-19 16:22:15Z apevec $" + - "$Author: apevec $" + - "$DateTime: 2004/08/16 18:10:38 $"; private static final Logger s_log = Logger.getLogger(BebopConfig.class); diff --git a/ccm-core/src/com/arsdigita/bebop/BlockStylable.java b/ccm-core/src/com/arsdigita/bebop/BlockStylable.java index b4259e284..a7222cd11 100755 --- a/ccm-core/src/com/arsdigita/bebop/BlockStylable.java +++ b/ccm-core/src/com/arsdigita/bebop/BlockStylable.java @@ -32,8 +32,6 @@ import com.arsdigita.bebop.util.Size; abstract public class BlockStylable extends TextStylable { - public static final String versionId = "$Id: BlockStylable.java 287 2005-02-22 00:29:02Z sskracic $ by $Author: sskracic $, $DateTime: 2004/08/16 18:10:38 $"; - /** * Left-align a component. */ diff --git a/ccm-core/src/com/arsdigita/bebop/BoxPanel.java b/ccm-core/src/com/arsdigita/bebop/BoxPanel.java index b84ed53ed..b9f4a7863 100755 --- a/ccm-core/src/com/arsdigita/bebop/BoxPanel.java +++ b/ccm-core/src/com/arsdigita/bebop/BoxPanel.java @@ -42,8 +42,6 @@ public class BoxPanel extends SimpleContainer implements BebopConstants { - public static final String versionId = "$Id: BoxPanel.java 287 2005-02-22 00:29:02Z sskracic $ by $Author: sskracic $, $DateTime: 2004/08/16 18:10:38 $"; - /** * Specifies that components should be laid out left to right. */ @@ -137,19 +135,19 @@ public class BoxPanel extends SimpleContainer setAttribute(WIDTH_ATTR, w); } - /** - * Sets whether a border should be drawn. - * - * @param isBorder true if a border should be drawn - * @deprecated Use {@link #setBorder(int border)} instead. - */ - public void setBorder(boolean isBorder) { - if (isBorder) { - setAttribute(BORDER_ATTR, "1"); - } else { - setAttribute(BORDER_ATTR, "0"); - } - } +// /** +// * Sets whether a border should be drawn. +// * +// * @param isBorder true if a border should be drawn +// * @deprecated Use {@link #setBorder(int border)} instead. +// */ +// public void setBorder(boolean isBorder) { +// if (isBorder) { +// setAttribute(BORDER_ATTR, "1"); +// } else { +// setAttribute(BORDER_ATTR, "0"); +// } +// } /** * diff --git a/ccm-core/src/com/arsdigita/bebop/Column.java b/ccm-core/src/com/arsdigita/bebop/Column.java index ff51a5020..1e51bfb96 100755 --- a/ccm-core/src/com/arsdigita/bebop/Column.java +++ b/ccm-core/src/com/arsdigita/bebop/Column.java @@ -30,9 +30,10 @@ import com.arsdigita.xml.Element; * */ public class Column extends SimpleComponent { - public static final String versionId = "$Id: Column.java 287 2005-02-22 00:29:02Z sskracic $ by $Author: sskracic $, $DateTime: 2004/08/16 18:10:38 $"; - private Multiple m_parent; // parent holding RowSequence - private String m_name; // name of the column to output + /** Parent holding RowSequence */ + private Multiple m_parent; + /** name of the column to output */ + private String m_name; /* Create a column. * @param parent indicates in to which {@link Multiple} this diff --git a/ccm-core/src/com/arsdigita/bebop/ColumnPanel.java b/ccm-core/src/com/arsdigita/bebop/ColumnPanel.java index 00567bf41..1e66dd21e 100755 --- a/ccm-core/src/com/arsdigita/bebop/ColumnPanel.java +++ b/ccm-core/src/com/arsdigita/bebop/ColumnPanel.java @@ -96,8 +96,6 @@ import com.arsdigita.xml.Element; * */ public class ColumnPanel extends SimpleContainer { - public static final String versionId = "$Id: ColumnPanel.java 287 2005-02-22 00:29:02Z sskracic $ by $Author: sskracic $, $DateTime: 2004/08/16 18:10:38 $"; - /** * An empty constraint corresponding to the default @@ -180,7 +178,7 @@ public class ColumnPanel extends SimpleContainer { * inside a ColumnPanel with the same number of columns */ public void setInserted(boolean inserted) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); m_inserted = inserted; } @@ -457,7 +455,7 @@ public class ColumnPanel extends SimpleContainer { * @param constraints the constraints to add */ public void setConstraint(Component c, int constraints) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); m_constraints.put(c, new Constraint(constraints)); } diff --git a/ccm-core/src/com/arsdigita/bebop/Completable.java b/ccm-core/src/com/arsdigita/bebop/Completable.java index 32e9b4d3c..111da673e 100755 --- a/ccm-core/src/com/arsdigita/bebop/Completable.java +++ b/ccm-core/src/com/arsdigita/bebop/Completable.java @@ -34,13 +34,12 @@ import org.apache.log4j.Logger; * * @author rhs@mit.edu * @version $Revision: #10 $ $Date: 2004/08/16 $ + * @version $Id: Completable.java 287 2005-02-22 00:29:02Z sskracic $ **/ public abstract class Completable implements Component { private final static Logger s_log = Logger.getLogger(Completable.class); - public final static String versionId = "$Id: Completable.java 287 2005-02-22 00:29:02Z sskracic $ by $Author: sskracic $, $DateTime: 2004/08/16 18:10:38 $"; - public Completable() { if ( s_log.isDebugEnabled() ) { StackTraces.captureStackTrace(this); @@ -50,7 +49,7 @@ public abstract class Completable implements Component { private ArrayList m_completionListeners = new ArrayList(); public void addCompletionListener(ActionListener listener) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); m_completionListeners.add(listener); } diff --git a/ccm-core/src/com/arsdigita/bebop/Component.java b/ccm-core/src/com/arsdigita/bebop/Component.java index 155695a6e..834e56303 100755 --- a/ccm-core/src/com/arsdigita/bebop/Component.java +++ b/ccm-core/src/com/arsdigita/bebop/Component.java @@ -140,11 +140,10 @@ import com.arsdigita.xml.Element; * @author Stanislav Freidin * @author Rory Solomon * - * @version $Id: Component.java 287 2005-02-22 00:29:02Z sskracic $ */ + * @version $Id: Component.java 287 2005-02-22 00:29:02Z sskracic $ + */ public interface Component extends Lockable { - public static final String versionId = "$Id: Component.java 287 2005-02-22 00:29:02Z sskracic $ by $Author: sskracic $, $DateTime: 2004/08/16 18:10:38 $"; - /** * The XML namespace used by all the Bebop components. */ diff --git a/ccm-core/src/com/arsdigita/bebop/ComponentPool.java b/ccm-core/src/com/arsdigita/bebop/ComponentPool.java index 5a04162a4..8f98345f1 100755 --- a/ccm-core/src/com/arsdigita/bebop/ComponentPool.java +++ b/ccm-core/src/com/arsdigita/bebop/ComponentPool.java @@ -44,10 +44,6 @@ import java.util.Map; public class ComponentPool { - public static final String versionId = "$Author: sskracic $" + - " - $Date: 2004/08/16 $ " + - "$Id: ComponentPool.java 287 2005-02-22 00:29:02Z sskracic $"; - private static final Logger s_cat = Logger.getLogger(ComponentPool.class.getName()); private static class _pool { @@ -70,8 +66,8 @@ public class ComponentPool { Component p = (Component)m_class.newInstance(); // At this point, the OnBuildPage method is called on the - // page to give it a chance to build its own specific page layout - // before putting it into the pool + // page to give it a chance to build its own specific page + // layout before putting it into the pool //p.OnBuildPage(); m_availComponents.add(p); diff --git a/ccm-core/src/com/arsdigita/bebop/ComponentSelectionModel.java b/ccm-core/src/com/arsdigita/bebop/ComponentSelectionModel.java index 071ccb56a..ccd1e0827 100755 --- a/ccm-core/src/com/arsdigita/bebop/ComponentSelectionModel.java +++ b/ccm-core/src/com/arsdigita/bebop/ComponentSelectionModel.java @@ -34,8 +34,6 @@ package com.arsdigita.bebop; */ public interface ComponentSelectionModel extends SingleSelectionModel { - public static final String versionId = "$Id: ComponentSelectionModel.java 287 2005-02-22 00:29:02Z sskracic $ by $Author: sskracic $, $DateTime: 2004/08/16 18:10:38 $"; - /** * Returns the component that should be used to output the currently diff --git a/ccm-core/src/com/arsdigita/bebop/Container.java b/ccm-core/src/com/arsdigita/bebop/Container.java index 5f67eb3d8..dc5b3bceb 100755 --- a/ccm-core/src/com/arsdigita/bebop/Container.java +++ b/ccm-core/src/com/arsdigita/bebop/Container.java @@ -31,8 +31,6 @@ package com.arsdigita.bebop; * */ public interface Container extends Component { - public static final String versionId = "$Id: Container.java 287 2005-02-22 00:29:02Z sskracic $ by $Author: sskracic $, $DateTime: 2004/08/16 18:10:38 $"; - /** * Adds a component to this container. * diff --git a/ccm-core/src/com/arsdigita/bebop/ControlLink.java b/ccm-core/src/com/arsdigita/bebop/ControlLink.java index fb5c87308..f4c4e8b37 100755 --- a/ccm-core/src/com/arsdigita/bebop/ControlLink.java +++ b/ccm-core/src/com/arsdigita/bebop/ControlLink.java @@ -66,8 +66,6 @@ import com.arsdigita.xml.Element; * @version $Id: ControlLink.java 287 2005-02-22 00:29:02Z sskracic $ */ public class ControlLink extends BaseLink { - public static final String versionId = "$Id: ControlLink.java 287 2005-02-22 00:29:02Z sskracic $ by $Author: sskracic $, $DateTime: 2004/08/16 18:10:38 $"; - /** * The XML type attribute for a {@link ControlLink}. */ @@ -109,7 +107,7 @@ public class ControlLink extends BaseLink { * @see #respond respond */ public void addActionListener(ActionListener l) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); if ( m_actionListeners == null ) { m_actionListeners = new ArrayList(); } @@ -122,7 +120,7 @@ public class ControlLink extends BaseLink { * @see #addActionListener addActionListener */ public void removeActionListener(ActionListener l) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); if ( m_actionListeners == null ) { return; } diff --git a/ccm-core/src/com/arsdigita/bebop/DefaultSingleSelectionModel.java b/ccm-core/src/com/arsdigita/bebop/DefaultSingleSelectionModel.java index cfbbb72fa..1c9f3e1e4 100755 --- a/ccm-core/src/com/arsdigita/bebop/DefaultSingleSelectionModel.java +++ b/ccm-core/src/com/arsdigita/bebop/DefaultSingleSelectionModel.java @@ -21,10 +21,12 @@ package com.arsdigita.bebop; import com.arsdigita.bebop.parameters.ParameterModel; +/** + * + * @version $Id: DefaultSingleSelectionModel.java 287 2005-02-22 00:29:02Z sskracic $ + */ public class DefaultSingleSelectionModel - extends AbstractSingleSelectionModel { - - public static final String versionId = "$Id: DefaultSingleSelectionModel.java 287 2005-02-22 00:29:02Z sskracic $ by $Author: sskracic $, $DateTime: 2004/08/16 18:10:38 $"; + extends AbstractSingleSelectionModel { private RequestLocal m_key; diff --git a/ccm-core/src/com/arsdigita/bebop/DimensionalNavbar.java b/ccm-core/src/com/arsdigita/bebop/DimensionalNavbar.java index ba0de59e6..67477268c 100755 --- a/ccm-core/src/com/arsdigita/bebop/DimensionalNavbar.java +++ b/ccm-core/src/com/arsdigita/bebop/DimensionalNavbar.java @@ -31,11 +31,10 @@ import java.util.Iterator; * * @author Michael Pih * @version $Revision: #9 $ $Date: 2004/08/16 $ + * @version $Id: DimensionalNavbar.java 287 2005-02-22 00:29:02Z sskracic $ */ public class DimensionalNavbar extends SimpleContainer { - public static final String versionId = "$Id: DimensionalNavbar.java 287 2005-02-22 00:29:02Z sskracic $ by $Author: sskracic $, $DateTime: 2004/08/16 18:10:38 $"; - private final static String BEBOP_XML_NS = "http://www.arsdigita.com/bebop/1.0"; public final static String LEFT = "left"; diff --git a/ccm-core/src/com/arsdigita/bebop/DynamicListWizard.java b/ccm-core/src/com/arsdigita/bebop/DynamicListWizard.java index dc65c387c..1da615b6c 100755 --- a/ccm-core/src/com/arsdigita/bebop/DynamicListWizard.java +++ b/ccm-core/src/com/arsdigita/bebop/DynamicListWizard.java @@ -39,11 +39,10 @@ import com.arsdigita.bebop.event.ChangeListener; * "add" pane will add a new item to the list. The "add" pane * will be visible only when the user clicks on the "add" link. * + * @version $Id: DynamicListWizard.java 287 2005-02-22 00:29:02Z sskracic $ */ public class DynamicListWizard extends SplitWizard implements Resettable { - public static final String versionId = "$Id: DynamicListWizard.java 287 2005-02-22 00:29:02Z sskracic $ by $Author: sskracic $, $DateTime: 2004/08/16 18:10:38 $"; - private Label m_listLabel; private ToggleLink m_addLink; private Component m_editPane; @@ -212,13 +211,19 @@ public class DynamicListWizard extends SplitWizard implements Resettable { } /** - * Return the List of items in the left pane - * @deprecated use getListingComponent instead + * Convenient method for {Link getListingComponent } to return the + * List of items in the left pane as List. */ - public List getList() { + // Had been + // * @deprecated use getListingComponent instead (not a 1:1 replacement, + // * different return type! + // Currently still used in ccm-bookmarks ui BookmarkEditPane + // public List getList() { + public List getListOfComponents() { Component c = getListingComponent(); - Assert.assertTrue(c instanceof List, - "The listing component is not a List, but " + c.getClass().getName()); + Assert.isTrue(c instanceof List, + "The listing component is not a List, but " + + c.getClass().getName()); return (List)c; } @@ -248,7 +253,7 @@ public class DynamicListWizard extends SplitWizard implements Resettable { * selected */ public void setAddPane(Component c) { - Assert.assertTrue(m_addPane == null, "Add pane has already been set"); + Assert.isTrue(m_addPane == null, "Add pane has already been set"); if(!super.contains(c)) { super.add(c); @@ -275,7 +280,7 @@ public class DynamicListWizard extends SplitWizard implements Resettable { * is selected */ public void setEditPane(Component c) { - Assert.assertTrue(m_editPane == null, "Edit pane has already been set"); + Assert.isTrue(m_editPane == null, "Edit pane has already been set"); if(!super.contains(c)) { super.add(c); diff --git a/ccm-core/src/com/arsdigita/bebop/ElementComponent.java b/ccm-core/src/com/arsdigita/bebop/ElementComponent.java index 44401d592..553f8a052 100755 --- a/ccm-core/src/com/arsdigita/bebop/ElementComponent.java +++ b/ccm-core/src/com/arsdigita/bebop/ElementComponent.java @@ -24,11 +24,11 @@ import org.apache.log4j.Logger; /** * A component that gets its text entirely from a single XSL element. * - * @author Sameer Ajmani + * @author Sameer Ajmani + * @version $Id: ElementComponent.java 287 2005-02-22 00:29:02Z sskracic $ **/ public class ElementComponent extends SimpleComponent { - public static final String versionId = "$Id: ElementComponent.java 287 2005-02-22 00:29:02Z sskracic $ by $Author: sskracic $, $DateTime: 2004/08/16 18:10:38 $"; private static final Logger s_log = Logger.getLogger(ElementComponent.class.getName()); diff --git a/ccm-core/src/com/arsdigita/bebop/ExcursionComponent.java b/ccm-core/src/com/arsdigita/bebop/ExcursionComponent.java index 6316263ca..db1df81e2 100755 --- a/ccm-core/src/com/arsdigita/bebop/ExcursionComponent.java +++ b/ccm-core/src/com/arsdigita/bebop/ExcursionComponent.java @@ -24,13 +24,11 @@ import com.arsdigita.bebop.event.ActionListener; * ExcursionComponent * * @author rhs@mit.edu - * @version $Revision: #7 $ $Date: 2004/08/16 $ + * @version $Id: ExcursionComponent.java 287 2005-02-22 00:29:02Z sskracic $ **/ public interface ExcursionComponent extends Component { - public final static String versionId = "$Id: ExcursionComponent.java 287 2005-02-22 00:29:02Z sskracic $ by $Author: sskracic $, $DateTime: 2004/08/16 18:10:38 $"; - void addCompletionListener(ActionListener listener); } diff --git a/ccm-core/src/com/arsdigita/bebop/ExternalLink.java b/ccm-core/src/com/arsdigita/bebop/ExternalLink.java index 3d53b7681..627dea1d1 100755 --- a/ccm-core/src/com/arsdigita/bebop/ExternalLink.java +++ b/ccm-core/src/com/arsdigita/bebop/ExternalLink.java @@ -26,10 +26,11 @@ import com.arsdigita.bebop.event.PrintListener; * *

See {@link BaseLink} for a description * of all Bebop Link classes. - **/ + * + * @version $Id: ExternalLink.java 287 2005-02-22 00:29:02Z sskracic $ + */ public class ExternalLink extends Link { - public static final String versionId = "$Id: ExternalLink.java 287 2005-02-22 00:29:02Z sskracic $ by $Author: sskracic $, $DateTime: 2004/08/16 18:10:38 $"; public ExternalLink(Component child, String url) { super(child, url); } diff --git a/ccm-core/src/com/arsdigita/bebop/Form.java b/ccm-core/src/com/arsdigita/bebop/Form.java index 79c9f8a0f..c1a100ee9 100755 --- a/ccm-core/src/com/arsdigita/bebop/Form.java +++ b/ccm-core/src/com/arsdigita/bebop/Form.java @@ -269,7 +269,7 @@ public class Form extends FormSection implements BebopConstants { * value for this flag is false.

*/ public void setRedirecting(boolean isRedirecting) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); m_isRedirecting = isRedirecting; } @@ -301,7 +301,7 @@ public class Form extends FormSection implements BebopConstants { * @pre ! isLocked() */ public void setName(String name) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); setAttribute(NAME, name); } @@ -323,7 +323,7 @@ public class Form extends FormSection implements BebopConstants { * @pre ! isLocked() */ public void setEncType(String encType) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); setAttribute("enctype", encType); } @@ -337,7 +337,7 @@ public class Form extends FormSection implements BebopConstants { * @pre ! isLocked() */ public void setOnSubmit(String javascriptCode) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); setAttribute("onSubmit", javascriptCode); } @@ -351,7 +351,7 @@ public class Form extends FormSection implements BebopConstants { * @pre ! isLocked() */ public void setOnReset(String javascriptCode) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); setAttribute("onReset", javascriptCode); } @@ -362,7 +362,7 @@ public class Form extends FormSection implements BebopConstants { * @pre ! isLocked() */ public void setMethod(String method) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); setAttribute(METHOD, method); } @@ -404,7 +404,7 @@ public class Form extends FormSection implements BebopConstants { * @param action the URL to submit this form to * @pre ! isLocked() */ public void setAction(String action) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); m_action = action; } @@ -433,7 +433,7 @@ public class Form extends FormSection implements BebopConstants { * @post return != null */ public FormData process(PageState state) throws FormProcessException { - Assert.assertNotNull(state, "PageState"); + Assert.exists(state, "PageState"); FormData result = new FormData(getModel(), state.getRequest()); setFormData(state, result); diff --git a/ccm-core/src/com/arsdigita/bebop/FormData.java b/ccm-core/src/com/arsdigita/bebop/FormData.java index 7f7013fdb..64325944e 100755 --- a/ccm-core/src/com/arsdigita/bebop/FormData.java +++ b/ccm-core/src/com/arsdigita/bebop/FormData.java @@ -257,9 +257,9 @@ public class FormData implements Map, Cloneable { FormData fallback) throws FormProcessException { - Assert.assertNotNull(model, "FormModel"); - Assert.assertNotNull(request, "HttpServletRequest"); - Assert.assertNotNull(locale, "Locale"); + Assert.exists(model, "FormModel"); + Assert.exists(request, "HttpServletRequest"); + Assert.exists(locale, "Locale"); m_locale = locale; m_model = model; @@ -622,7 +622,7 @@ public class FormData implements Map, Cloneable { parameterModel.createParameterData(request, defaultValue, isSubmission()); - Assert.assertNotNull(parameterData); + Assert.exists(parameterData); setParameter(parameterModel.getName(), parameterData); } m_isTransformed=true; diff --git a/ccm-core/src/com/arsdigita/bebop/FormModel.java b/ccm-core/src/com/arsdigita/bebop/FormModel.java index fff81a88d..a0a3a27f3 100755 --- a/ccm-core/src/com/arsdigita/bebop/FormModel.java +++ b/ccm-core/src/com/arsdigita/bebop/FormModel.java @@ -66,10 +66,6 @@ import org.apache.log4j.Logger; * @version $Id: FormModel.java 287 2005-02-22 00:29:02Z sskracic $ */ public class FormModel implements Lockable { - public static final String versionId = - "$Id: FormModel.java 287 2005-02-22 00:29:02Z sskracic $" + - "$Author: sskracic $" + - "$DateTime: 2004/08/16 18:10:38 $"; private static final Logger s_log = Logger.getLogger(FormModel.class); @@ -113,7 +109,7 @@ public class FormModel implements Lockable { * null ordinarily. */ FormModel(String name, boolean defaultOverridesNull) { - Assert.assertNotNull(name, "Name"); + Assert.exists(name, "Name"); m_parameterModels = new LinkedList(); m_parametersToExclude = new LinkedList(); m_listenerList = new EventListenerList(); @@ -147,8 +143,8 @@ public class FormModel implements Lockable { * @param parameter a parameter model object * */ public final void addFormParam(ParameterModel parameter) { - Assert.assertNotNull(parameter, "Parameter"); - Assert.assertNotLocked(this); + Assert.exists(parameter, "Parameter"); + Assert.isUnlocked(this); parameter.setDefaultOverridesNull(m_defaultOverridesNull); m_parameterModels.add(parameter); @@ -170,8 +166,8 @@ public class FormModel implements Lockable { * @param parameter a parameter model object * */ public final void excludeFormParameterFromExport(ParameterModel parameter) { - Assert.assertNotNull(parameter, "Parameter"); - Assert.assertNotLocked(this); + Assert.exists(parameter, "Parameter"); + Assert.isUnlocked(this); m_parametersToExclude.add(parameter); } @@ -184,7 +180,7 @@ public class FormModel implements Lockable { * parameter model; false otherwise. */ public final boolean containsFormParam(ParameterModel p) { - Assert.assertNotNull(p, "Parameter"); + Assert.exists(p, "Parameter"); return m_parameterModels.contains(p); } @@ -222,7 +218,7 @@ public class FormModel implements Lockable { * @param listener a FormSubmissionListener value */ public void addSubmissionListener(FormSubmissionListener listener) { - Assert.assertNotNull(listener, "Submission Listener"); + Assert.exists(listener, "Submission Listener"); m_listenerList.add(FormSubmissionListener.class, listener); } @@ -235,8 +231,8 @@ public class FormModel implements Lockable { * FormValidationListener interface * */ public void addValidationListener(FormValidationListener listener) { - Assert.assertNotNull(listener, "FormValidationListener"); - Assert.assertNotLocked(this); + Assert.exists(listener, "FormValidationListener"); + Assert.isUnlocked(this); m_listenerList.add(FormValidationListener.class, listener); } @@ -252,8 +248,8 @@ public class FormModel implements Lockable { * FormInitListener interface * */ public void addInitListener(FormInitListener listener) { - Assert.assertNotNull(listener, "FormInitListener"); - Assert.assertNotLocked(this); + Assert.exists(listener, "FormInitListener"); + Assert.isUnlocked(this); m_listenerList.add(FormInitListener.class, listener); } @@ -269,8 +265,8 @@ public class FormModel implements Lockable { * FormProcessListener interface * */ public void addProcessListener(FormProcessListener listener) { - Assert.assertNotNull(listener, "FormProcessListener"); - Assert.assertNotLocked(this); + Assert.exists(listener, "FormProcessListener"); + Assert.isUnlocked(this); m_listenerList.add(FormProcessListener.class, listener); } @@ -285,7 +281,7 @@ public class FormModel implements Lockable { * @return a FormData object. * */ public FormData process(PageState state) throws FormProcessException { - Assert.assertLocked(this); + Assert.isLocked(this); boolean isSubmission = state.getRequest().getParameter(getMagicTagName()) != null; return process(state, isSubmission); @@ -304,7 +300,7 @@ public class FormModel implements Lockable { */ public FormData process(PageState state, boolean isSubmission) throws FormProcessException { - Assert.assertLocked(this); + Assert.isLocked(this); FormData data = new FormData(this, state.getRequest(), isSubmission); try { DeveloperSupport.startStage("Bebop Form Model Process"); @@ -409,8 +405,8 @@ public class FormModel implements Lockable { protected void fireSubmitted(FormSectionEvent e) throws FormProcessException { - Assert.assertNotNull(e.getFormData(), "FormData"); - Assert.assertLocked(this); + Assert.exists(e.getFormData(), "FormData"); + Assert.isLocked(this); FormProcessException delayedException = null; Iterator i = m_listenerList.getListenerIterator(FormSubmissionListener.class); @@ -432,8 +428,8 @@ public class FormModel implements Lockable { * @param e a FormSectionEvent originating from the form */ protected void fireFormInit(FormSectionEvent e) throws FormProcessException { - Assert.assertNotNull(e.getFormData(), "FormData"); - Assert.assertLocked(this); + Assert.exists(e.getFormData(), "FormData"); + Assert.isLocked(this); Iterator i = m_listenerList.getListenerIterator(FormInitListener.class); while (i.hasNext()) { ((FormInitListener) i.next()).init(e); @@ -449,7 +445,7 @@ public class FormModel implements Lockable { * */ protected void fireParameterValidation(FormSectionEvent e) { FormData data = e.getFormData(); - Assert.assertNotNull(data, "FormData"); + Assert.exists(data, "FormData"); Iterator parameters = getParameters(); ParameterModel parameterModel; ParameterData parameterData; @@ -475,7 +471,7 @@ public class FormModel implements Lockable { * */ private void fireFormValidation(FormSectionEvent e) { FormData data = e.getFormData(); - Assert.assertNotNull(data, "FormData"); + Assert.exists(data, "FormData"); Iterator i = m_listenerList.getListenerIterator(FormValidationListener.class); while (i.hasNext()) { try { @@ -494,7 +490,7 @@ public class FormModel implements Lockable { * */ private void fireFormProcess(FormSectionEvent e) throws FormProcessException { - Assert.assertNotNull(e.getFormData(), "FormData"); + Assert.exists(e.getFormData(), "FormData"); if (!e.getFormData().isValid()) { throw new IllegalStateException("Request data must be valid " + "prior to running processing filters."); } @@ -535,7 +531,7 @@ public class FormModel implements Lockable { * @pre data != null * */ void validate(PageState state, FormData data) { - Assert.assertNotNull(data, "FormData"); + Assert.exists(data, "FormData"); if (!data.isTransformed()) { throw new IllegalStateException("Request data must be transformed " + "prior to running validation filters."); } @@ -551,8 +547,8 @@ public class FormModel implements Lockable { * @param m The FormModel to be merged into this FormModel * */ void mergeModel(FormModel m) { - Assert.assertNotLocked(this); - Assert.assertNotNull(m, "FormSection's FormModel"); + Assert.isUnlocked(this); + Assert.exists(m, "FormSection's FormModel"); m_parameterModels.addAll(m.m_parameterModels); m_listenerList.addAll(m.m_listenerList); } @@ -568,9 +564,9 @@ public class FormModel implements Lockable { } /** - * Checks whether this FormModel is locked. + * Checks whether this FormModel is isLocked. * - * @return true if this FormModel is locked; + * @return true if this FormModel is isLocked; * false otherwise. * */ public final boolean isLocked() { diff --git a/ccm-core/src/com/arsdigita/bebop/FormSection.java b/ccm-core/src/com/arsdigita/bebop/FormSection.java index 66f6072e6..a609e9050 100755 --- a/ccm-core/src/com/arsdigita/bebop/FormSection.java +++ b/ccm-core/src/com/arsdigita/bebop/FormSection.java @@ -61,10 +61,6 @@ import org.apache.log4j.Logger; * @see FormModel */ public class FormSection extends SimpleComponent implements Container { - public static final String versionId = - "$Id: FormSection.java 287 2005-02-22 00:29:02Z sskracic $" + - "$Author: sskracic $" + - "$DateTime: 2004/08/16 18:10:38 $"; private static final Logger s_log = Logger.getLogger(FormSection.class); @@ -151,8 +147,8 @@ public class FormSection extends SimpleComponent implements Container { this); } - Assert.assertNotNull(listener, "Submission Listener"); - Assert.assertNotLocked(this); + Assert.exists(listener, "Submission Listener"); + Assert.isUnlocked(this); forwardSubmission(); m_listeners.add(FormSubmissionListener.class, listener); } @@ -169,8 +165,8 @@ public class FormSection extends SimpleComponent implements Container { this); } - Assert.assertNotNull(listener, "Submission Listener"); - Assert.assertNotLocked(this); + Assert.exists(listener, "Submission Listener"); + Assert.isUnlocked(this); m_listeners.remove(FormSubmissionListener.class, listener); } @@ -184,7 +180,7 @@ public class FormSection extends SimpleComponent implements Container { */ protected void fireSubmitted(FormSectionEvent e) throws FormProcessException { - Assert.assertNotNull(e.getFormData(), "FormData"); + Assert.exists(e.getFormData(), "FormData"); FormProcessException delayedException = null; Iterator i = m_listeners.getListenerIterator(FormSubmissionListener @@ -248,8 +244,8 @@ public class FormSection extends SimpleComponent implements Container { s_log.debug("Adding init listener " + listener + " to " + this); } - Assert.assertNotNull(listener, "FormInitListener"); - Assert.assertNotLocked(this); + Assert.exists(listener, "FormInitListener"); + Assert.isUnlocked(this); forwardInit(); m_listeners.add(FormInitListener.class, listener); } @@ -266,8 +262,8 @@ public class FormSection extends SimpleComponent implements Container { this); } - Assert.assertNotNull(listener, "Init Listener"); - Assert.assertNotLocked(this); + Assert.exists(listener, "Init Listener"); + Assert.isUnlocked(this); m_listeners.remove(FormInitListener.class, listener); } @@ -280,8 +276,8 @@ public class FormSection extends SimpleComponent implements Container { * exception. */ protected void fireInit(FormSectionEvent e) throws FormProcessException { - Assert.assertNotNull(e.getFormData(), "FormData"); - Assert.assertLocked(this); + Assert.exists(e.getFormData(), "FormData"); + Assert.isLocked(this); Iterator i = m_listeners.getListenerIterator(FormInitListener.class); while (i.hasNext()) { final FormInitListener listener = (FormInitListener) i.next(); @@ -334,8 +330,8 @@ public class FormSection extends SimpleComponent implements Container { this); } - Assert.assertNotNull(listener, "FormValidationListener"); - Assert.assertNotLocked(this); + Assert.exists(listener, "FormValidationListener"); + Assert.isUnlocked(this); forwardValidation(); m_listeners.add(FormValidationListener.class, listener); } @@ -352,8 +348,8 @@ public class FormSection extends SimpleComponent implements Container { this); } - Assert.assertNotNull(listener, "Validation Listener"); - Assert.assertNotLocked(this); + Assert.exists(listener, "Validation Listener"); + Assert.isUnlocked(this); m_listeners.remove(FormValidationListener.class, listener); } @@ -365,7 +361,7 @@ public class FormSection extends SimpleComponent implements Container { */ protected void fireValidate(FormSectionEvent e) { FormData data = e.getFormData(); - Assert.assertNotNull(data, "FormData"); + Assert.exists(data, "FormData"); Iterator i = m_listeners.getListenerIterator(FormValidationListener .class); while (i.hasNext()) { @@ -426,8 +422,8 @@ public class FormSection extends SimpleComponent implements Container { s_log.debug("Adding process listener " + listener + " to " + this); } - Assert.assertNotNull(listener, "FormProcessListener"); - Assert.assertNotLocked(this); + Assert.exists(listener, "FormProcessListener"); + Assert.isUnlocked(this); forwardProcess(); m_listeners.add(FormProcessListener.class, listener); @@ -445,8 +441,8 @@ public class FormSection extends SimpleComponent implements Container { this); } - Assert.assertNotNull(listener, "Process Listener"); - Assert.assertNotLocked(this); + Assert.exists(listener, "Process Listener"); + Assert.isUnlocked(this); m_listeners.remove(FormProcessListener.class, listener); } @@ -481,7 +477,7 @@ public class FormSection extends SimpleComponent implements Container { */ protected void fireProcess(FormSectionEvent e) throws FormProcessException { - Assert.assertNotNull(e.getFormData(), "FormData"); + Assert.exists(e.getFormData(), "FormData"); Iterator i = m_listeners.getListenerIterator(FormProcessListener.class); while (i.hasNext()) { final FormProcessListener listener = (FormProcessListener) i.next(); @@ -520,8 +516,8 @@ public class FormSection extends SimpleComponent implements Container { s_log.debug("Adding cancel listener " + listener + " to " + this); } - Assert.assertNotNull(listener, "FormCancelListener"); - Assert.assertNotLocked(this); + Assert.exists(listener, "FormCancelListener"); + Assert.isUnlocked(this); m_listeners.add(FormCancelListener.class, listener); } @@ -537,8 +533,8 @@ public class FormSection extends SimpleComponent implements Container { this); } - Assert.assertNotNull(listener, "Cancel Listener"); - Assert.assertNotLocked(this); + Assert.exists(listener, "Cancel Listener"); + Assert.isUnlocked(this); m_listeners.remove(FormCancelListener.class, listener); } @@ -552,7 +548,7 @@ public class FormSection extends SimpleComponent implements Container { */ protected void fireCancel(FormSectionEvent e) throws FormProcessException { - Assert.assertNotNull(e.getFormData(), "FormData"); + Assert.exists(e.getFormData(), "FormData"); Iterator i = m_listeners.getListenerIterator(FormCancelListener.class); while (i.hasNext()) { final FormCancelListener listener = (FormCancelListener) i.next(); diff --git a/ccm-core/src/com/arsdigita/bebop/FormStep.java b/ccm-core/src/com/arsdigita/bebop/FormStep.java index db9b27f1d..a7dbcad81 100755 --- a/ccm-core/src/com/arsdigita/bebop/FormStep.java +++ b/ccm-core/src/com/arsdigita/bebop/FormStep.java @@ -45,14 +45,12 @@ import com.arsdigita.xml.Element; * @see MultiStepForm * * @author rhs@mit.edu - * @version $Revision: #9 $ $Date: 2004/08/16 $ + * @version $Id: FormStep.java 1414 2006-12-07 14:24:10Z chrisgilbert23 $ **/ public class FormStep extends FormSection { private final static Logger s_log = Logger.getLogger(FormStep.class); - public final static String versionId = "$Id: FormStep.java 1414 2006-12-07 14:24:10Z chrisgilbert23 $ by $Author: chrisgilbert23 $, $DateTime: 2004/08/16 18:10:38 $"; - private Form m_form = null; // cg - changed to using a parameter that is stored in pagestate so that if there are links diff --git a/ccm-core/src/com/arsdigita/bebop/FormValidationException.java b/ccm-core/src/com/arsdigita/bebop/FormValidationException.java index d98e77e17..3f2792d7b 100755 --- a/ccm-core/src/com/arsdigita/bebop/FormValidationException.java +++ b/ccm-core/src/com/arsdigita/bebop/FormValidationException.java @@ -25,13 +25,11 @@ import com.arsdigita.bebop.form.Widget; * FormValidationException * * @author rhs@mit.edu - * @version $Revision: #7 $ $Date: 2004/08/16 $ + * @version $Id: FormValidationException.java 287 2005-02-22 00:29:02Z sskracic $ **/ public class FormValidationException extends FormProcessException { - public final static String versionId = "$Id: FormValidationException.java 287 2005-02-22 00:29:02Z sskracic $ by $Author: sskracic $, $DateTime: 2004/08/16 18:10:38 $"; - private String m_name = null; public FormValidationException(String message) { diff --git a/ccm-core/src/com/arsdigita/bebop/Grid.java b/ccm-core/src/com/arsdigita/bebop/Grid.java index 0e6857b8a..39ce11d26 100755 --- a/ccm-core/src/com/arsdigita/bebop/Grid.java +++ b/ccm-core/src/com/arsdigita/bebop/Grid.java @@ -33,11 +33,11 @@ import com.arsdigita.util.LockableImpl; /** * Displays a {@link ListModel} as a grid (that is, a {@link Table}) * of given width. + * + * @version $Id: Grid.java 287 2005-02-22 00:29:02Z sskracic $ */ public class Grid extends Table { - public static final String versionId = "$Id: Grid.java 287 2005-02-22 00:29:02Z sskracic $ by $Author: sskracic $, $DateTime: 2004/08/16 18:10:38 $"; - private int m_cols; /** diff --git a/ccm-core/src/com/arsdigita/bebop/GridPanel.java b/ccm-core/src/com/arsdigita/bebop/GridPanel.java index bdc832d9a..4cfe54c4f 100755 --- a/ccm-core/src/com/arsdigita/bebop/GridPanel.java +++ b/ccm-core/src/com/arsdigita/bebop/GridPanel.java @@ -103,7 +103,6 @@ import com.arsdigita.xml.Element; * @version $Id: GridPanel.java 287 2005-02-22 00:29:02Z sskracic $ */ public class GridPanel extends SimpleContainer implements BebopConstants { - public static final String versionId = "$Id: GridPanel.java 287 2005-02-22 00:29:02Z sskracic $ by $Author: sskracic $, $DateTime: 2004/08/16 18:10:38 $"; private static final ChildConstraint DEFAULT_CONSTRAINT = new ChildConstraint(); @@ -168,7 +167,7 @@ public class GridPanel extends SimpleContainer implements BebopConstants { * */ public void setInserted(boolean isInserted) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); m_isInserted = isInserted; } diff --git a/ccm-core/src/com/arsdigita/bebop/GridTableModel.java b/ccm-core/src/com/arsdigita/bebop/GridTableModel.java index 764bfd940..3c92442fd 100755 --- a/ccm-core/src/com/arsdigita/bebop/GridTableModel.java +++ b/ccm-core/src/com/arsdigita/bebop/GridTableModel.java @@ -35,12 +35,12 @@ import java.util.ArrayList; * * The extraneous cells in the table are filled * with GridTableModel.PLACEHOLDER. + * + * @version $Id: GridTableModel.java 287 2005-02-22 00:29:02Z sskracic $ */ public class GridTableModel implements TableModel { - public static final String versionId = "$Id: GridTableModel.java 287 2005-02-22 00:29:02Z sskracic $ by $Author: sskracic $, $DateTime: 2004/08/16 18:10:38 $"; - private ListModel m_items; private int m_colHeight, m_cols, m_size, m_index; private Object[] m_elements; diff --git a/ccm-core/src/com/arsdigita/bebop/HorizontalLine.java b/ccm-core/src/com/arsdigita/bebop/HorizontalLine.java index a01bb4161..530519d56 100755 --- a/ccm-core/src/com/arsdigita/bebop/HorizontalLine.java +++ b/ccm-core/src/com/arsdigita/bebop/HorizontalLine.java @@ -25,15 +25,13 @@ import com.arsdigita.xml.Element; * A solid, horizontal line. * * @author Michael Pih - * @version $Revision: #8 $ $Date: 2004/08/16 $ + * @version $Id: HorizontalLine.java 287 2005-02-22 00:29:02Z sskracic $ */ // FIXME: Could this be done solely in XSL ? Or do some of these attributes // come from the DB/user preferences ? It would be cleaner if we could move // this completely to XSL. public class HorizontalLine extends SimpleComponent { - public static final String versionId = "$Id: HorizontalLine.java 287 2005-02-22 00:29:02Z sskracic $ by $Author: sskracic $, $DateTime: 2004/08/16 18:10:38 $"; - private String m_width; private String m_height; private String m_bgcolor; diff --git a/ccm-core/src/com/arsdigita/bebop/Image.java b/ccm-core/src/com/arsdigita/bebop/Image.java index 4b38ccf33..a330f3ee8 100755 --- a/ccm-core/src/com/arsdigita/bebop/Image.java +++ b/ccm-core/src/com/arsdigita/bebop/Image.java @@ -35,7 +35,6 @@ import com.arsdigita.bebop.event.PrintEvent; public class Image extends BlockStylable { - public static final String versionId = "$Id: Image.java 287 2005-02-22 00:29:02Z sskracic $ by $Author: sskracic $, $DateTime: 2004/08/16 18:10:38 $"; private final String IMAGE_URL = "src"; private final String ALT = "alt"; private final String HEIGHT = "height"; @@ -66,12 +65,12 @@ public class Image extends BlockStylable { } public void setImageURL(String imageURL) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); setAttribute(IMAGE_URL, imageURL); } public void setAlt(String alt) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); setAttribute(ALT, alt); } /** @@ -79,7 +78,7 @@ public class Image extends BlockStylable { * */ public void setHeight(String height) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); setAttribute(HEIGHT, height); } @@ -88,7 +87,7 @@ public class Image extends BlockStylable { * */ public void setWidth(String width) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); setAttribute(WIDTH, width); } @@ -97,7 +96,7 @@ public class Image extends BlockStylable { * */ public void setBorder(String border) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); setAttribute(BORDER, border); } diff --git a/ccm-core/src/com/arsdigita/bebop/Label.java b/ccm-core/src/com/arsdigita/bebop/Label.java index 62c469c7f..e5ca0bf85 100755 --- a/ccm-core/src/com/arsdigita/bebop/Label.java +++ b/ccm-core/src/com/arsdigita/bebop/Label.java @@ -35,8 +35,6 @@ import com.arsdigita.xml.Element; */ public class Label extends BlockStylable implements Cloneable { - public static final String versionId = "$Id: Label.java 287 2005-02-22 00:29:02Z sskracic $ by $Author: sskracic $, $DateTime: 2004/08/16 18:10:38 $"; - private static final String NO_LABEL = ""; public static final String BOLD = "b"; @@ -239,7 +237,7 @@ public class Label extends BlockStylable implements Cloneable { */ public void setLabel(GlobalizedMessage label, PageState state) { if (state == null) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); m_label = label; } else { m_requestLabel.set(state, label); @@ -273,7 +271,7 @@ public class Label extends BlockStylable implements Cloneable { } public void setFontWeight(String fontWeight) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); m_fontWeight = fontWeight; } diff --git a/ccm-core/src/com/arsdigita/bebop/Link.java b/ccm-core/src/com/arsdigita/bebop/Link.java index a033581d7..8d8940e4e 100755 --- a/ccm-core/src/com/arsdigita/bebop/Link.java +++ b/ccm-core/src/com/arsdigita/bebop/Link.java @@ -44,13 +44,11 @@ import org.apache.log4j.Logger; *

The target of the link above will be rendered in HTML as: * href="path/to/target/?foo=1" * If either the link text or the URL needs to be changed for a link - * within a locked page, a {@link PrintListener} should be used. + * within a isLocked page, a {@link PrintListener} should be used. + * + * @version $Id: Link.java 287 2005-02-22 00:29:02Z sskracic $ */ public class Link extends BaseLink { - public static final String versionId = - "$Id: Link.java 287 2005-02-22 00:29:02Z sskracic $" + - "$Author: sskracic $" + - "$DateTime: 2004/08/16 18:10:38 $"; private static final Logger s_log = Logger.getLogger(ParameterMap.class); @@ -106,7 +104,7 @@ public class Link extends BaseLink { * the Link, without the need to make a separate call to * the addPrintListener method. PrintListeners * are a convenient way to alter underlying Link attributes - * such as Link text or target URL within a locked page + * such as Link text or target URL within a isLocked page * on a per request basis. */ public Link(Component child, PrintListener l) { @@ -190,18 +188,19 @@ public class Link extends BaseLink { * @pre name != null */ public void setVar(String name, String value) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); m_params.setParameter(name, value); } - /** - * Set a query variable and its value - * @deprecated use {@link #setVar setVar} - */ - public void addURLVars(String name, String value) { - setVar(name, value); - } +// No longer used anywhere in the code base +// /** +// * Set a query variable and its value +// * @deprecated use {@link #setVar setVar} +// */ +// public void addURLVars(String name, String value) { +// setVar(name, value); +// } public String getURLVarString() { return m_params.toString(); diff --git a/ccm-core/src/com/arsdigita/bebop/List.java b/ccm-core/src/com/arsdigita/bebop/List.java index ce9e2e369..32e74865a 100755 --- a/ccm-core/src/com/arsdigita/bebop/List.java +++ b/ccm-core/src/com/arsdigita/bebop/List.java @@ -54,7 +54,6 @@ import com.arsdigita.xml.Element; */ public class List extends SimpleComponent implements BebopConstants { - public static final String versionId = "$Id: List.java 287 2005-02-22 00:29:02Z sskracic $ by $Author: sskracic $, $DateTime: 2004/08/16 18:10:38 $"; /** * The name of the StringParameter that the list uses to keep track of * which item is selected. @@ -194,7 +193,7 @@ public class List extends SimpleComponent implements BebopConstants { * @pre ! isLocked() */ public void register(Page p) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); if ( m_selection.getStateParameter() != null ) { p.addComponentStateParam(this, m_selection.getStateParameter()); } @@ -283,7 +282,7 @@ public class List extends SimpleComponent implements BebopConstants { Element item = list.newChildElement(BEBOP_CELL, BEBOP_XML_NS); String key = m.getKey(); - Assert.assertNotNull(key); + Assert.exists(key); // Converting both keys to String for comparison // since ListModel.getKey returns a String @@ -334,8 +333,8 @@ public class List extends SimpleComponent implements BebopConstants { * @param layout New layout value, must be List.VERTICAL or List.HORIZONTAL **/ public void setLayout(int layout) { - Assert.assertNotLocked(this); - Assert.assertTrue((layout == VERTICAL) || (layout == HORIZONTAL), + Assert.isUnlocked(this); + Assert.isTrue((layout == VERTICAL) || (layout == HORIZONTAL), "Invalid layout code passed to setLayout"); m_layout = layout; } @@ -378,7 +377,7 @@ public class List extends SimpleComponent implements BebopConstants { * @see com.arsdigita.bebop.list.ListCellRenderer */ public final void setCellRenderer(ListCellRenderer r) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); m_renderer = r; } @@ -403,7 +402,7 @@ public class List extends SimpleComponent implements BebopConstants { * @see ListModelBuilder */ public final void setModelBuilder(ListModelBuilder b) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); m_modelBuilder = b; } @@ -415,7 +414,7 @@ public class List extends SimpleComponent implements BebopConstants { * @param c the new empty view component */ public final void setEmptyView(Component c) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); m_emptyView = c; } @@ -465,7 +464,7 @@ public class List extends SimpleComponent implements BebopConstants { * @pre ! isLocked() */ public void setListData(Object[] values) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); m_modelBuilder = new ArrayListModelBuilder(values); } @@ -483,7 +482,7 @@ public class List extends SimpleComponent implements BebopConstants { * @pre ! isLocked() */ public void setListData(Map map) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); m_modelBuilder = new MapListModelBuilder(map); } @@ -508,7 +507,7 @@ public class List extends SimpleComponent implements BebopConstants { * @pre ! isLocked() */ public final void setSelectionModel(SingleSelectionModel m) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); if ( m_changeListener != null ) { // Transfer the change listener m_selection.removeChangeListener(m_changeListener); @@ -591,7 +590,7 @@ public class List extends SimpleComponent implements BebopConstants { * @pre ! isLocked() */ public void addChangeListener(ChangeListener l) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); if ( m_changeListener == null ) { m_changeListener = createChangeListener(); m_selection.addChangeListener(m_changeListener); @@ -608,7 +607,7 @@ public class List extends SimpleComponent implements BebopConstants { * @param l the change listener to remove from the list */ public void removeChangeListener(ChangeListener l) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); m_listeners.remove(ChangeListener.class, l); } @@ -644,7 +643,7 @@ public class List extends SimpleComponent implements BebopConstants { * @see #respond respond */ public void addActionListener(ActionListener l) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); m_listeners.add(ActionListener.class, l); } @@ -655,7 +654,7 @@ public class List extends SimpleComponent implements BebopConstants { * @see #addActionListener addActionListener */ public void removeActionListener(ActionListener l) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); m_listeners.remove(ActionListener.class, l); } diff --git a/ccm-core/src/com/arsdigita/bebop/ListPanel.java b/ccm-core/src/com/arsdigita/bebop/ListPanel.java index b6576c6b6..f6aa34fa7 100755 --- a/ccm-core/src/com/arsdigita/bebop/ListPanel.java +++ b/ccm-core/src/com/arsdigita/bebop/ListPanel.java @@ -36,7 +36,6 @@ import com.arsdigita.xml.Element; * */ public class ListPanel extends SimpleContainer { - public static final String versionId = "$Id: ListPanel.java 287 2005-02-22 00:29:02Z sskracic $ by $Author: sskracic $, $DateTime: 2004/08/16 18:10:38 $"; public static final boolean ORDERED = true ; public static final boolean UNORDERED = false; private boolean m_ordered; diff --git a/ccm-core/src/com/arsdigita/bebop/MapComponentSelectionModel.java b/ccm-core/src/com/arsdigita/bebop/MapComponentSelectionModel.java index 4715ebdb0..3cd7136f5 100755 --- a/ccm-core/src/com/arsdigita/bebop/MapComponentSelectionModel.java +++ b/ccm-core/src/com/arsdigita/bebop/MapComponentSelectionModel.java @@ -41,8 +41,6 @@ import com.arsdigita.util.Lockable; public class MapComponentSelectionModel implements ComponentSelectionModel, Lockable { - public static final String versionId = "$Id: MapComponentSelectionModel.java 287 2005-02-22 00:29:02Z sskracic $ by $Author: sskracic $, $DateTime: 2004/08/16 18:10:38 $"; - private SingleSelectionModel m_selModel; private Map m_components; private boolean m_locked; @@ -115,7 +113,7 @@ public class MapComponentSelectionModel * @param c the component for the mapping */ public void add(Object key, Component c) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); m_components.put(key, c); } @@ -172,7 +170,7 @@ public class MapComponentSelectionModel * @param l a listener to notify when the selected key changes */ public void addChangeListener(ChangeListener l) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); m_selModel.addChangeListener(l); } @@ -182,7 +180,7 @@ public class MapComponentSelectionModel * @param l the listener to remove */ public void removeChangeListener(ChangeListener l) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); m_selModel.removeChangeListener(l); } diff --git a/ccm-core/src/com/arsdigita/bebop/MapWizard.java b/ccm-core/src/com/arsdigita/bebop/MapWizard.java index 8e1a7c7dc..8b2e15b39 100755 --- a/ccm-core/src/com/arsdigita/bebop/MapWizard.java +++ b/ccm-core/src/com/arsdigita/bebop/MapWizard.java @@ -49,11 +49,12 @@ import com.arsdigita.bebop.event.ChangeListener; * In addition, the wizard overrides the default pane behavior. * If no step is selected, the wizard automatically selects the default * step. The default step may be changed with + * + * + * @version $Id: MapWizard.java 287 2005-02-22 00:29:02Z sskracic $ */ public class MapWizard extends SplitWizard { - public static final String versionId = "$Id: MapWizard.java 287 2005-02-22 00:29:02Z sskracic $ by $Author: sskracic $, $DateTime: 2004/08/16 18:10:38 $"; - /** * The name of the state parameter which stores the current selection */ @@ -98,30 +99,30 @@ public class MapWizard extends SplitWizard { // Ensure consistency s.addChangeListener(new ChangeListener() { - public void stateChanged(ChangeEvent e) { - PageState state = e.getPageState(); - Object key = getCurrentStepKey(state); + public void stateChanged(ChangeEvent e) { + PageState state = e.getPageState(); + Object key = getCurrentStepKey(state); - if (key == null) { - return; - } - - if (!m_panels.containsKey(key)) { - throw new IllegalArgumentException ( - "Key " + key + " is not in the wizard" - ); - } - - int i = m_panels.findKey(key); - int prog = getProgress(state); - if (i > prog) { - throw new IllegalArgumentException ( - "Key " + key + " identifies the component at index " + i + - ", but the highest enabled step is " + prog - ); - } + if (key == null) { + return; } - }); + + if (!m_panels.containsKey(key)) { + throw new IllegalArgumentException ("Key " + key + + " is not in the wizard" + ); + } + + int i = m_panels.findKey(key); + int prog = getProgress(state); + if (i > prog) { + throw new IllegalArgumentException ("Key " + key + + " identifies the component at index " + i + + ", but the highest enabled step is " + prog + ); + } + } + }); MapComponentSelectionModel sel = new MapComponentSelectionModel(s, m_panels); diff --git a/ccm-core/src/com/arsdigita/bebop/MetaForm.java b/ccm-core/src/com/arsdigita/bebop/MetaForm.java index 3b8d08662..716fdeba7 100755 --- a/ccm-core/src/com/arsdigita/bebop/MetaForm.java +++ b/ccm-core/src/com/arsdigita/bebop/MetaForm.java @@ -47,8 +47,6 @@ import com.arsdigita.xml.Element; public abstract class MetaForm extends Form { - public static final String versionId = "$Id: MetaForm.java 287 2005-02-22 00:29:02Z sskracic $ by $Author: sskracic $, $DateTime: 2004/08/16 18:10:38 $"; - private RequestLocal m_dynamicForm; /** diff --git a/ccm-core/src/com/arsdigita/bebop/ModalContainer.java b/ccm-core/src/com/arsdigita/bebop/ModalContainer.java index f0a26f979..8c894901a 100755 --- a/ccm-core/src/com/arsdigita/bebop/ModalContainer.java +++ b/ccm-core/src/com/arsdigita/bebop/ModalContainer.java @@ -29,17 +29,14 @@ import org.apache.log4j.Logger; * A modal container is a container that manages visibility for a set of * components. It allows only one of its children to be visible. One of its * children can be selected as the default visible component. If none is - * selected the child with index equal to zero is used. The modal container + * selected the child with index isEqual to zero is used. The modal container * sets the appropriate default and PageState-based visibility for its * children. * * @author Archit Shah + * @version $Id: ModalContainer.java 1414 2006-12-07 14:24:10Z chrisgilbert23 $ **/ public class ModalContainer extends SimpleContainer implements Resettable { - public static final String versionId = - "$Id: ModalContainer.java 1414 2006-12-07 14:24:10Z chrisgilbert23 $" + - "$Author: chrisgilbert23 $" + - "$DateTime: 2004/08/16 18:10:38 $"; private static final Logger s_log = Logger.getLogger(ModalContainer.class); @@ -57,7 +54,7 @@ public class ModalContainer extends SimpleContainer implements Resettable { } public void register(Page p) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); Iterator it = children(); while (it.hasNext()) { @@ -70,7 +67,7 @@ public class ModalContainer extends SimpleContainer implements Resettable { } public void setDefaultComponent(Component c) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); if (!contains(c)) { add(c); @@ -162,7 +159,7 @@ public class ModalContainer extends SimpleContainer implements Resettable { * (i.e., visible component) is changed using setVisibleComponent(). **/ public void addModeChangeListener(ChangeListener cl) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); m_changeListeners.add(cl); } diff --git a/ccm-core/src/com/arsdigita/bebop/MultiStepForm.java b/ccm-core/src/com/arsdigita/bebop/MultiStepForm.java index 33136511f..4e4dd86e3 100755 --- a/ccm-core/src/com/arsdigita/bebop/MultiStepForm.java +++ b/ccm-core/src/com/arsdigita/bebop/MultiStepForm.java @@ -57,13 +57,11 @@ import com.arsdigita.xml.Element; * * @author rhs@mit.edu * @version $Revision: 1.1 $ $Date: 2006/11/13 10:14:35 $ + * @version $Id: MultiStepForm.java 1537 2007-03-23 15:33:34Z chrisgilbert23 $ **/ public class MultiStepForm extends Form implements FormInitListener{ - public final static String versionId = - "$Id: MultiStepForm.java 1537 2007-03-23 15:33:34Z chrisgilbert23 $ by $Author: chrisgilbert23 $, $DateTime: 2004/08/16 18:10:38 $"; - private boolean m_useSession = false; // parameter that allows allows action links on forms - diff --git a/ccm-core/src/com/arsdigita/bebop/Multiple.java b/ccm-core/src/com/arsdigita/bebop/Multiple.java index 97ab90350..7ca3fd53d 100755 --- a/ccm-core/src/com/arsdigita/bebop/Multiple.java +++ b/ccm-core/src/com/arsdigita/bebop/Multiple.java @@ -23,8 +23,7 @@ import com.arsdigita.xml.Element; import com.arsdigita.persistence.DataQuery; /** - * . A - * container that outputs its components repeatedly for each row in a + * A container that outputs its components repeatedly for each row in a * RowSequence. * * @author Christian Brechbühler (christian@arsdigita.com) @@ -34,7 +33,6 @@ import com.arsdigita.persistence.DataQuery; public class Multiple extends SimpleContainer { - public static final String versionId = "$Id: Multiple.java 287 2005-02-22 00:29:02Z sskracic $ by $Author: sskracic $, $DateTime: 2004/08/16 18:10:38 $"; private RequestLocal m_rows; // a RowSequence private RowSequenceBuilder m_builder = null; diff --git a/ccm-core/src/com/arsdigita/bebop/Page.java b/ccm-core/src/com/arsdigita/bebop/Page.java index adb277322..fc467786b 100755 --- a/ccm-core/src/com/arsdigita/bebop/Page.java +++ b/ccm-core/src/com/arsdigita/bebop/Page.java @@ -82,13 +82,9 @@ import org.apache.log4j.Logger; */ public class Page extends BlockStylable implements Container { - public static final String versionId = - "$Id: Page.java 1270 2006-07-18 13:34:55Z cgyg9330 $" + - "by $Author: cgyg9330 $, $DateTime: 2004/08/16 18:10:38 $"; + /** Class specific logger instance. */ private static final Logger s_log = Logger.getLogger(Page.class); - /** - * The delimiter character for components naming - */ + /** The delimiter character for components naming */ private static final String DELIMITER = "."; /** * The prefix that gets prepended to all state variables. Components must @@ -454,7 +450,7 @@ public class Page extends BlockStylable implements Container { * @param title title for this page */ public void setTitle(String title) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); setTitle(new Label(title)); } @@ -464,7 +460,7 @@ public class Page extends BlockStylable implements Container { * @param title title for this page */ public void setTitle(Label title) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); m_title = title; } @@ -481,7 +477,7 @@ public class Page extends BlockStylable implements Container { * in the current PageState */ public final void setErrorDisplay(Component c) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); m_errorDisplay = c; } @@ -501,29 +497,29 @@ public class Page extends BlockStylable implements Container { return m_errorDisplay; } - /** - * Sets a stylesheet that should be used in HTML output. To use - * a CSS stylesheet, call something like - * setStyleSheet("style.css", "text/css"). - *

- * These values will ultimately wind up in a <link> tag in - * the head of the HTML page. - *

- * Note that the stylesheet set with this call has nothing to do with the - * XSLT stylesheet (transformer) that is applied to the XML generated - * from this page. - * - * @param styleSheetURI the location of the stylesheet - * @param styleSheetType the MIME type of the stylesheet, usually - * text/css - * @pre ! isLocked() - * @deprecated Use {@link #addClientStylesheet addClientStylesheet} - * instead. Will be removed on 2001-05-31. - */ - public void setStyleSheet(String styleSheetURI, String styleSheetType) { - Assert.assertNotLocked(this); - addClientStylesheet(styleSheetURI, styleSheetType); - } +// /** +// * Sets a stylesheet that should be used in HTML output. To use +// * a CSS stylesheet, call something like +// * setStyleSheet("style.css", "text/css"). +// *

+// * These values will ultimately wind up in a <link> tag in +// * the head of the HTML page. +// *

+// * Note that the stylesheet set with this call has nothing to do with the +// * XSLT stylesheet (transformer) that is applied to the XML generated +// * from this page. +// * +// * @param styleSheetURI the location of the stylesheet +// * @param styleSheetType the MIME type of the stylesheet, usually +// * text/css +// * @pre ! isLocked() +// * @deprecated Use {@link #addClientStylesheet addClientStylesheet} +// * instead. Will be removed on 2001-05-31. +// */ +// public void setStyleSheet(String styleSheetURI, String styleSheetType) { +// Assert.isUnlocked(this); +// addClientStylesheet(styleSheetURI, styleSheetType); +// } /** * Adds a client-side stylesheet that should be used in HTML @@ -565,7 +561,7 @@ public class Page extends BlockStylable implements Container { * @pre parameter != null */ public void addGlobalStateParam(ParameterModel p) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); p.setName(unmangle(p.getName())); m_stateModel.addFormParam(p); } @@ -591,7 +587,7 @@ public class Page extends BlockStylable implements Container { * @pre isLocked() */ protected Element generateXMLHelper(PageState ps, Document parent) { - Assert.assertLocked(this); + Assert.isLocked(this); Element page = parent.createRootElement("bebop:page", BEBOP_XML_NS); exportAttributes(page); @@ -687,7 +683,7 @@ public class Page extends BlockStylable implements Container { * component. */ public void process(PageState state) throws ServletException { - Assert.assertLocked(this); + Assert.isLocked(this); try { DeveloperSupport.startStage("Bebop Request Event"); fireRequestEvent(state); @@ -715,20 +711,19 @@ public class Page extends BlockStylable implements Container { } } - /** - * Does all the servicing of a request except output generation. - * This includes most of the common duties of buildDocument and print. - * - * @deprecated Use {@link - * #process(HttpServletRequest,HttpServletResponse)} instead. - */ - protected PageState prepare(HttpServletRequest req, HttpServletResponse res) - throws ServletException { - - Assert.assertLocked(this); - PageState state = process(req, res); - return state; - } +// /** +// * Does all the servicing of a request except output generation. +// * This includes most of the common duties of buildDocument and print. +// * +// * @deprecated Use {@link +// * #process(HttpServletRequest,HttpServletResponse)} instead. +// */ +// protected PageState prepare(HttpServletRequest req, HttpServletResponse res) +// throws ServletException { +// Assert.isLocked(this); +// PageState state = process(req, res); +// return state; +// } /** * Builds a DOM Document from the current request state by @@ -777,7 +772,7 @@ public class Page extends BlockStylable implements Container { */ private void finish() { if (!m_finished) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); Traversal componentRegistrar = new Traversal() { @@ -833,7 +828,7 @@ public class Page extends BlockStylable implements Container { * @pre ! isLocked() */ public void addActionListener(ActionListener l) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); m_actionListeners.add(l); } @@ -843,7 +838,7 @@ public class Page extends BlockStylable implements Container { * @pre ! isLocked() */ public void removeActionListener(ActionListener l) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); m_actionListeners.remove(l); } @@ -854,7 +849,7 @@ public class Page extends BlockStylable implements Container { * @pre ! isLocked() */ public void addRequestListener(RequestListener l) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); m_requestListeners.add(l); } @@ -865,7 +860,7 @@ public class Page extends BlockStylable implements Container { * @pre ! isLocked() */ public void removeRequestListener(RequestListener l) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); m_requestListeners.remove(l); } @@ -947,7 +942,7 @@ public class Page extends BlockStylable implements Container { * @deprecated This method will become private in ACS 5.0. */ public void addComponent(Component c) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); if (!stateContains(c)) { if (c == null) { @@ -960,8 +955,9 @@ public class Page extends BlockStylable implements Container { key = Integer.toString(m_components.size()); } if (m_componentMap.get(key) != null) { - throw new IllegalArgumentException("Component key must not be duplicated. The key " + - key + " is shared by more than one component."); + throw new IllegalArgumentException( + "Component key must not be duplicated. The key " + + key + " is shared by more than one component."); } m_componentMap.put(key, c); m_components.add(c); @@ -986,7 +982,7 @@ public class Page extends BlockStylable implements Container { * @pre p != null */ public void addComponentStateParam(Component c, ParameterModel p) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); if (!stateContains(c)) { throw new IllegalArgumentException("Component must be registered in Page"); @@ -1093,7 +1089,7 @@ public class Page extends BlockStylable implements Container { * @see Component#setVisible Component.setVisible */ public boolean isVisibleDefault(Component c) { - Assert.assertTrue(stateContains(c)); + Assert.isTrue(stateContains(c)); return !m_invisible.get(stateIndex(c)); } @@ -1114,7 +1110,7 @@ public class Page extends BlockStylable implements Container { * @see Component#register Component.register */ public void setVisibleDefault(Component c, boolean v) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); addComponent(c); int i = stateIndex(c); diff --git a/ccm-core/src/com/arsdigita/bebop/PageDispatcher.java b/ccm-core/src/com/arsdigita/bebop/PageDispatcher.java.nolongerInUse similarity index 100% rename from ccm-core/src/com/arsdigita/bebop/PageDispatcher.java rename to ccm-core/src/com/arsdigita/bebop/PageDispatcher.java.nolongerInUse diff --git a/ccm-core/src/com/arsdigita/bebop/PageErrorDisplay.java b/ccm-core/src/com/arsdigita/bebop/PageErrorDisplay.java index bd82cd73b..4e5372d05 100755 --- a/ccm-core/src/com/arsdigita/bebop/PageErrorDisplay.java +++ b/ccm-core/src/com/arsdigita/bebop/PageErrorDisplay.java @@ -31,13 +31,11 @@ import java.util.Iterator; * Displays validation errors for the page. These might have occured due to validation * listeners on some state parameters within the page. * - * @author Stanislav Freidin - * @version $Id: PageErrorDisplay.java 287 2005-02-22 00:29:02Z sskracic $ + * @author Stanislav Freidin + * @version $Id: PageErrorDisplay.java 287 2005-02-22 00:29:02Z sskracic $ */ public class PageErrorDisplay extends List { - public static final String versionId = "$Id: PageErrorDisplay.java 287 2005-02-22 00:29:02Z sskracic $ by $Author: sskracic $, $DateTime: 2004/08/16 18:10:38 $"; - private static final String COLOR = "color"; /** diff --git a/ccm-core/src/com/arsdigita/bebop/PageState.java b/ccm-core/src/com/arsdigita/bebop/PageState.java index 33db8ce4d..860856a63 100755 --- a/ccm-core/src/com/arsdigita/bebop/PageState.java +++ b/ccm-core/src/com/arsdigita/bebop/PageState.java @@ -158,15 +158,10 @@ import org.apache.log4j.Logger; */ public class PageState { - public static final String versionId = - "$Id: PageState.java 975 2005-11-07 09:27:08Z clasohm $ " + - "by $Author: clasohm $, $DateTime: 2004/08/16 18:10:38 $"; - + /** Class specific logger instance. */ private static final Logger s_log = Logger.getLogger(PageState.class); - /** - * The underlying Page object. - */ + /** The underlying Page object. */ private Page m_page; /** @@ -542,35 +537,35 @@ public class PageState { * PageState is alive, typically only for the duration of * the request. * - * @deprecated Use either setAttribute on {@link +// * @deprecated Use either setAttribute on {@link * HttpServletRequest the HTTP request object}, or, preferrably, use a * {@link RequestLocal request local} variable. Will be removed on * 2001-06-13. * */ - public void setAttribute(Object key, Object value) { - if ( m_attributes == null ) { - m_attributes = new HashMap(); - } - m_attributes.put(key, value); - } +// public void setAttribute(Object key, Object value) { +// if ( m_attributes == null ) { +// m_attributes = new HashMap(); +// } +// m_attributes.put(key, value); +// } /** * Get the value of an attribute stored with the same key with {@link * #setAttribute setAttribute}. * - * @deprecated Use either getAttribute on {@link +// * @deprecated Use either getAttribute on {@link * HttpServletRequest the HTTP request object}, or, preferrably, use a * {@link RequestLocal request local} variable. Will be removed on * 2001-06-13. * */ - public Object getAttribute(Object key) { - if ( m_attributes == null ) { - return null; - } - return m_attributes.get(key); - } +// public Object getAttribute(Object key) { +// if ( m_attributes == null ) { +// return null; +// } +// return m_attributes.get(key); +// } /** * Set the value of the state parameter p. The concrete @@ -637,15 +632,15 @@ public class PageState { /** * Change the value of a global parameter * - * @deprecated Use {@link #setValue(ParameterModel m, Object o)} +// * @deprecated Use {@link #setValue(ParameterModel m, Object o)} * instead. If you don't have a reference to the parameter model, you * should not be calling this method. Instead, the component that * registered the parameter should provide methods to manipulate * it. Will be removed 2001-06-20. */ - public void setGlobalValue(String name, Object value) { - m_pageState.put(m_page.parameterName(name), value); - } +// public void setGlobalValue(String name, Object value) { +// m_pageState.put(m_page.parameterName(name), value); +// } // Handling the control event diff --git a/ccm-core/src/com/arsdigita/bebop/ParameterSingleSelectionModel.java b/ccm-core/src/com/arsdigita/bebop/ParameterSingleSelectionModel.java index 1d3a5b34c..db4021c93 100755 --- a/ccm-core/src/com/arsdigita/bebop/ParameterSingleSelectionModel.java +++ b/ccm-core/src/com/arsdigita/bebop/ParameterSingleSelectionModel.java @@ -88,7 +88,7 @@ public class ParameterSingleSelectionModel if (Assert.isEnabled()) { final FormModel model = state.getPage().getStateModel(); - Assert.truth(model.containsFormParam(m_parameter)); + Assert.isTrue(model.containsFormParam(m_parameter)); } state.setValue(m_parameter, newKey); diff --git a/ccm-core/src/com/arsdigita/bebop/PropertyEditor.java b/ccm-core/src/com/arsdigita/bebop/PropertyEditor.java index 50fdb3e26..d57a6052a 100755 --- a/ccm-core/src/com/arsdigita/bebop/PropertyEditor.java +++ b/ccm-core/src/com/arsdigita/bebop/PropertyEditor.java @@ -156,7 +156,7 @@ public class PropertyEditor extends SimpleContainer { /** * Constructs a new, empty PropertyEditor. * The {@link #setDisplayComponent(Component)} method must be called before - * this component is locked. + * this component is isLocked. */ public PropertyEditor() { this(null); @@ -239,7 +239,7 @@ public class PropertyEditor extends SimpleContainer { // Set the display component visible by default, and the // form(s) invisible by default public void register(Page p) { - Assert.assertNotNull(m_display, "display component"); + Assert.exists(m_display, "display component"); p.setVisibleDefault(m_displayPane, true); @@ -525,7 +525,7 @@ public class PropertyEditor extends SimpleContainer { * @param b the property editor model builder */ protected final void setModelBuilder(PropertyEditorModelBuilder b) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); m_builder = b; m_list.setModelBuilder(new BuilderAdapter(this)); } @@ -641,14 +641,14 @@ public class PropertyEditor extends SimpleContainer { } public Component getComponent() { - Assert.assertNotNull(m_entry); + Assert.exists(m_entry); ControlLink l = new ControlLink(new Label((String)m_entry.getValue())); l.setClassAttr("actionLink"); return l; } public Object getKey() { - Assert.assertNotNull(m_entry); + Assert.exists(m_entry); return m_entry.getKey(); } } diff --git a/ccm-core/src/com/arsdigita/bebop/RequestLocal.java b/ccm-core/src/com/arsdigita/bebop/RequestLocal.java index 82585764b..597327105 100755 --- a/ccm-core/src/com/arsdigita/bebop/RequestLocal.java +++ b/ccm-core/src/com/arsdigita/bebop/RequestLocal.java @@ -60,8 +60,6 @@ import javax.servlet.http.HttpServletRequest; */ public class RequestLocal { - public static final String versionId = "$Id: RequestLocal.java 287 2005-02-22 00:29:02Z sskracic $ by $Author: sskracic $, $DateTime: 2004/08/16 18:10:38 $"; - private static final String ATTRIBUTE_KEY = "com.arsdigita.bebop.RequestLocal"; diff --git a/ccm-core/src/com/arsdigita/bebop/Resettable.java b/ccm-core/src/com/arsdigita/bebop/Resettable.java index cbceb0786..97b7c5ee8 100755 --- a/ccm-core/src/com/arsdigita/bebop/Resettable.java +++ b/ccm-core/src/com/arsdigita/bebop/Resettable.java @@ -27,10 +27,10 @@ import com.arsdigita.bebop.PageState; * to the user. The details of when the reset method is called are left * to the application programmer. * + * @version $Id: Resettable.java 287 2005-02-22 00:29:02Z sskracic $ */ public interface Resettable { - public static final String versionId = "$Id: Resettable.java 287 2005-02-22 00:29:02Z sskracic $ by $Author: sskracic $, $DateTime: 2004/08/16 18:10:38 $"; /** * Resets the state of the component to its original * appearance. diff --git a/ccm-core/src/com/arsdigita/bebop/RowSequenceBuilder.java b/ccm-core/src/com/arsdigita/bebop/RowSequenceBuilder.java index da76e0a0e..ad9821c57 100755 --- a/ccm-core/src/com/arsdigita/bebop/RowSequenceBuilder.java +++ b/ccm-core/src/com/arsdigita/bebop/RowSequenceBuilder.java @@ -20,8 +20,11 @@ package com.arsdigita.bebop; import com.arsdigita.persistence.DataQuery; +/** + * + * @version $Id: RowSequenceBuilder.java 287 2005-02-22 00:29:02Z sskracic $ + */ public interface RowSequenceBuilder { - public static final String versionId = "$Id: RowSequenceBuilder.java 287 2005-02-22 00:29:02Z sskracic $ by $Author: sskracic $, $DateTime: 2004/08/16 18:10:38 $"; DataQuery makeRowSequence(PageState state); } diff --git a/ccm-core/src/com/arsdigita/bebop/SaveCancelSection.java b/ccm-core/src/com/arsdigita/bebop/SaveCancelSection.java index 774698b69..3794ad8f4 100755 --- a/ccm-core/src/com/arsdigita/bebop/SaveCancelSection.java +++ b/ccm-core/src/com/arsdigita/bebop/SaveCancelSection.java @@ -27,12 +27,11 @@ import com.arsdigita.bebop.form.Submit; * A form section with two buttons (Save and Cancel) aligned to * the right. * - * @author Stanislav Freidin + * @author Stanislav Freidin + * @version $Id: SaveCancelSection.java 287 2005-02-22 00:29:02Z sskracic $ */ public class SaveCancelSection extends FormSection { - public static final String versionId = "$Id: SaveCancelSection.java 287 2005-02-22 00:29:02Z sskracic $ by $Author: sskracic $, $DateTime: 2004/08/16 18:10:38 $"; - private Submit m_saveWidget, m_cancelWidget; /** diff --git a/ccm-core/src/com/arsdigita/bebop/SegmentedPanel.java b/ccm-core/src/com/arsdigita/bebop/SegmentedPanel.java index ce2da2d41..1463d5d8e 100755 --- a/ccm-core/src/com/arsdigita/bebop/SegmentedPanel.java +++ b/ccm-core/src/com/arsdigita/bebop/SegmentedPanel.java @@ -66,15 +66,14 @@ import com.arsdigita.bebop.util.BebopConstants; * </bebop:segmentedPanel> * * - * @author Michael Pih - * @version $Revision: #11 $ $Date: 2004/08/16 $ * @see #generateXML(PageState, Element) + * + * @author Michael Pih + * @version $Id: SegmentedPanel.java 287 2005-02-22 00:29:02Z sskracic $ */ public class SegmentedPanel extends SimpleContainer implements BebopConstants { - public static final String versionId = "$Id: SegmentedPanel.java 287 2005-02-22 00:29:02Z sskracic $ by $Author: sskracic $, $DateTime: 2004/08/16 18:10:38 $"; - public static final String HEADER_CLASS = "seg-header"; /** @@ -204,7 +203,7 @@ public class SegmentedPanel extends SimpleContainer * @param c an additional header component */ public void addHeader(Component c) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); if(m_header == null) { m_header = new SimpleContainer(BEBOP_SEG_HEADER, BEBOP_XML_NS); super.add(m_header); @@ -216,7 +215,7 @@ public class SegmentedPanel extends SimpleContainer * Add a component to the body of this segment */ public void add(Component c) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); if(m_body == null) { m_body = new SimpleContainer(BEBOP_SEG_BODY, BEBOP_XML_NS); super.add(m_body); diff --git a/ccm-core/src/com/arsdigita/bebop/SessionExpiredException.java b/ccm-core/src/com/arsdigita/bebop/SessionExpiredException.java index f5e192823..9e0aad4ec 100755 --- a/ccm-core/src/com/arsdigita/bebop/SessionExpiredException.java +++ b/ccm-core/src/com/arsdigita/bebop/SessionExpiredException.java @@ -20,6 +20,11 @@ package com.arsdigita.bebop; import javax.servlet.ServletException; +/** + * + * + * @version $Id: SessionExpiredException.java 287 2005-02-22 00:29:02Z sskracic $ + */ public class SessionExpiredException extends ServletException { - public static final String versionId = "$Id: SessionExpiredException.java 287 2005-02-22 00:29:02Z sskracic $ by $Author: sskracic $, $DateTime: 2004/08/16 18:10:38 $"; + } diff --git a/ccm-core/src/com/arsdigita/bebop/SimpleComponent.java b/ccm-core/src/com/arsdigita/bebop/SimpleComponent.java index 76bd91589..720f80678 100755 --- a/ccm-core/src/com/arsdigita/bebop/SimpleComponent.java +++ b/ccm-core/src/com/arsdigita/bebop/SimpleComponent.java @@ -40,21 +40,20 @@ import com.arsdigita.xml.Element; public class SimpleComponent extends Completable implements Component, Cloneable { - public static final String versionId = "$Id: SimpleComponent.java 1498 2007-03-19 16:22:15Z apevec $ by $Author: apevec $, $DateTime: 2004/08/16 18:10:38 $"; private boolean m_locked; /** * The Attribute object is protected to make * it easier for the Form Builder service to persist the SimpleComponent. - * Locking violation is not a problem since if the SimpleComponent is locked - * then the Attribute object will also be locked. + * Locking violation is not a problem since if the SimpleComponent is isLocked + * then the Attribute object will also be isLocked. */ protected Attributes m_attr; private String m_key = null; // name mangling key /** - * Clones a component. The clone is not locked and has its own set of + * Clones a component. The clone is not isLocked and has its own set of * attributes. * @return the clone of a component. * @post ! ((SimpleComponent) return).isLocked() @@ -109,7 +108,7 @@ public class SimpleComponent extends Completable /** * Unlocks this component. Package visibility is intentional; the * only time a component should be unlocked is when it's pooled and - * gets locked because it's put into a page. It needs to be unlocked + * gets isLocked because it's put into a page. It needs to be unlocked * when the instance is recycled. */ void unlock() { @@ -133,7 +132,7 @@ public class SimpleComponent extends Completable * href="http://www.w3.org/TR/2000/REC-xml-20001006#NT-Name">XML name */ public void setClassAttr(String theClass) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); setAttribute(CLASS, theClass); } @@ -156,7 +155,7 @@ public class SimpleComponent extends Completable * @see Standard Attributes */ public void setStyleAttr(String style) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); setAttribute(STYLE, style); } @@ -181,7 +180,7 @@ public class SimpleComponent extends Completable * @see Standard Attributes */ public void setIdAttr(String id) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); setAttribute(ID, id); } @@ -199,7 +198,7 @@ public class SimpleComponent extends Completable * @param value new attribute value */ final protected void setAttribute(String name, String value) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); if (m_attr == null) { m_attr = new Attributes(); } @@ -269,7 +268,7 @@ public class SimpleComponent extends Completable * @param key the key to mangle */ public Component setKey(String key) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); if (key.charAt(0) >= 0 && key.charAt(0) <= 9) //TODO: be more strict. throw new IllegalArgumentException ("key \"" + key + "\" must not start with a digit."); diff --git a/ccm-core/src/com/arsdigita/bebop/SimpleContainer.java b/ccm-core/src/com/arsdigita/bebop/SimpleContainer.java index 607e02fe1..679b9b030 100755 --- a/ccm-core/src/com/arsdigita/bebop/SimpleContainer.java +++ b/ccm-core/src/com/arsdigita/bebop/SimpleContainer.java @@ -55,12 +55,11 @@ import com.arsdigita.xml.Element; * @author Rory Solomon * @author Uday Mathur * - * @version $Id: SimpleContainer.java 287 2005-02-22 00:29:02Z sskracic $*/ + * @version $Id: SimpleContainer.java 287 2005-02-22 00:29:02Z sskracic $ + */ public class SimpleContainer extends BlockStylable implements Container { - public static final String versionId = "$Id: SimpleContainer.java 287 2005-02-22 00:29:02Z sskracic $ by $Author: sskracic $, $DateTime: 2004/08/16 18:10:38 $"; - private List m_components; private String m_tag, m_ns; @@ -92,7 +91,7 @@ public class SimpleContainer extends BlockStylable implements Container { * @param pc the component to be added */ public void add(Component pc) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); Assert.exists(pc); m_components.add(pc); } @@ -172,7 +171,7 @@ public class SimpleContainer extends BlockStylable implements Container { * in any manner. */ protected final void setTag(String tag) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); m_tag = tag; } @@ -183,7 +182,7 @@ public class SimpleContainer extends BlockStylable implements Container { * @param ns the XML namespace */ protected final void setNamespace(String ns) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); m_ns = ns; } diff --git a/ccm-core/src/com/arsdigita/bebop/SingleSelectionModel.java b/ccm-core/src/com/arsdigita/bebop/SingleSelectionModel.java index e93fddcbc..02d1f3daf 100755 --- a/ccm-core/src/com/arsdigita/bebop/SingleSelectionModel.java +++ b/ccm-core/src/com/arsdigita/bebop/SingleSelectionModel.java @@ -43,8 +43,6 @@ import com.arsdigita.bebop.parameters.ParameterModel; */ public interface SingleSelectionModel { - public static final String versionId = "$Id: SingleSelectionModel.java 287 2005-02-22 00:29:02Z sskracic $ by $Author: sskracic $, $DateTime: 2004/08/16 18:10:38 $"; - /** * Returns true if there is a selected element. * diff --git a/ccm-core/src/com/arsdigita/bebop/SlaveComponent.java b/ccm-core/src/com/arsdigita/bebop/SlaveComponent.java index 68edd98f6..8ab5d893a 100755 --- a/ccm-core/src/com/arsdigita/bebop/SlaveComponent.java +++ b/ccm-core/src/com/arsdigita/bebop/SlaveComponent.java @@ -29,6 +29,8 @@ import javax.servlet.ServletException; * position of a slave page subtree inside another page's component * tree. Its generateXML method does nothing but call generateXML on * the input page. + * + * @version $Id: SlaveComponent.java 287 2005-02-22 00:29:02Z sskracic $ */ public class SlaveComponent extends SimpleComponent { @@ -37,8 +39,9 @@ public class SlaveComponent extends SimpleComponent { private Page m_slavePage; - public final static String versionId = "$Id: SlaveComponent.java 287 2005-02-22 00:29:02Z sskracic $ by $Author: sskracic $, $DateTime: 2004/08/16 18:10:38 $"; - + /** + * Constructor. + */ public SlaveComponent() { super(); } @@ -59,8 +62,11 @@ public class SlaveComponent extends SimpleComponent { // then re-importing the created notes into a new document try { Document doc = new Document(); + // prepare is deprecated + // PageState slaveState = + // m_slavePage.prepare(ps.getRequest(), ps.getResponse()); PageState slaveState = - m_slavePage.prepare(ps.getRequest(), ps.getResponse()); + m_slavePage.process(ps.getRequest(), ps.getResponse()); m_slavePage.generateXML(slaveState, doc); parent.addContent(doc.getRootElement()); } catch (ParserConfigurationException pce) { diff --git a/ccm-core/src/com/arsdigita/bebop/SplitPanel.java b/ccm-core/src/com/arsdigita/bebop/SplitPanel.java index d064bd827..6dc692730 100755 --- a/ccm-core/src/com/arsdigita/bebop/SplitPanel.java +++ b/ccm-core/src/com/arsdigita/bebop/SplitPanel.java @@ -34,14 +34,13 @@ import com.arsdigita.xml.Element; * * This container contains three components: "left", "right" and "header". * All three components must be present (non-null) before SplitPanel - * is locked. An exception will be thrown if this is not the case. + * is isLocked. An exception will be thrown if this is not the case. * * @author Stanislav Freidin * @version $Id: SplitPanel.java 287 2005-02-22 00:29:02Z sskracic $ */ public class SplitPanel extends SimpleContainer { - public static final String versionId = "$Id: SplitPanel.java 287 2005-02-22 00:29:02Z sskracic $ by $Author: sskracic $, $DateTime: 2004/08/16 18:10:38 $"; private Component m_left, m_right, m_header; private int m_divider; @@ -96,7 +95,7 @@ public class SplitPanel extends SimpleContainer { * @param divider the position of the divider */ public void setDivider(int divider) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); if (divider < 0 || divider > 100) { throw new IllegalArgumentException("Divider must be in range 0..100"); @@ -171,7 +170,7 @@ public class SplitPanel extends SimpleContainer { * @param c the new component to be put in the header */ public void setHeader(Component c) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); if (!super.contains(c)) { super.add(c); @@ -187,7 +186,7 @@ public class SplitPanel extends SimpleContainer { * @param c the new component to be put in the left slot */ public void setLeftComponent(Component c) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); if (!super.contains(c)) { super.add(c); @@ -203,7 +202,7 @@ public class SplitPanel extends SimpleContainer { * @param c the new component to be put in the right slot */ public void setRightComponent(Component c) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); if (!super.contains(c)) { super.add(c); @@ -246,9 +245,9 @@ public class SplitPanel extends SimpleContainer { * Verifies that the header, left, and right components exist. */ public void lock() { - Assert.assertNotNull(getHeader(), "Header"); - Assert.assertNotNull(getLeftComponent(), "Left Component"); - Assert.assertNotNull(getRightComponent(), "Right Component"); + Assert.exists(getHeader(), "Header"); + Assert.exists(getLeftComponent(), "Left Component"); + Assert.exists(getRightComponent(), "Right Component"); super.lock(); } } diff --git a/ccm-core/src/com/arsdigita/bebop/SplitWizard.java b/ccm-core/src/com/arsdigita/bebop/SplitWizard.java index 3a7cbe177..32d80ec91 100755 --- a/ccm-core/src/com/arsdigita/bebop/SplitWizard.java +++ b/ccm-core/src/com/arsdigita/bebop/SplitWizard.java @@ -18,13 +18,8 @@ */ package com.arsdigita.bebop; - import com.arsdigita.bebop.util.GlobalizationUtil ; - - import com.arsdigita.util.Assert; -import com.arsdigita.util.Assert; - import com.arsdigita.xml.Element; /** @@ -60,12 +55,11 @@ import com.arsdigita.xml.Element; * Both the selector and the model must be supplied * before the wizard can be displayed. * + * @version $Id: SplitWizard.java 287 2005-02-22 00:29:02Z sskracic $ */ public class SplitWizard extends SplitPanel { - public static final String versionId = "$Id: SplitWizard.java 287 2005-02-22 00:29:02Z sskracic $ by $Author: sskracic $, $DateTime: 2004/08/16 18:10:38 $"; - private ComponentSelectionModel m_sel; private Component m_defaultPane; private Component m_selector; @@ -82,9 +76,8 @@ public class SplitWizard extends SplitPanel { * @param defaultPane the component that will be shown if there is no * selected component. Usually, this parameter is a simple label. */ - public SplitWizard ( - Component header, ComponentSelectionModel model, Component defaultPane - ) { + public SplitWizard (Component header, ComponentSelectionModel model, + Component defaultPane ) { this(model, defaultPane); setHeader(header); } @@ -98,9 +91,7 @@ public class SplitWizard extends SplitPanel { * @param defaultPane the component that will be shown if there is no * selected component. Usually, this parameter is a simple label. */ - public SplitWizard ( - ComponentSelectionModel model, Component defaultPane - ) { + public SplitWizard (ComponentSelectionModel model, Component defaultPane) { super(); m_defaultPane = defaultPane; if(m_defaultPane != null) @@ -119,7 +110,8 @@ public class SplitWizard extends SplitPanel { * selector */ public SplitWizard(ComponentSelectionModel model) { - this(model, new Label(GlobalizationUtil.globalize("bebop.please_select_choice_from_the_list_on_the_left"))); + this(model, new Label(GlobalizationUtil.globalize( + "bebop.please_select_choice_from_the_list_on_the_left"))); } /** @@ -140,7 +132,8 @@ public class SplitWizard extends SplitPanel { * selector */ public SplitWizard() { - this(null, new Label(GlobalizationUtil.globalize("bebop.please_select_choice_from_the_list_on_the_left"))); + this(null, new Label(GlobalizationUtil.globalize( + "bebop.please_select_choice_from_the_list_on_the_left"))); } /** @@ -174,7 +167,7 @@ public class SplitWizard extends SplitPanel { * component */ public void setSelectionModel(ComponentSelectionModel model) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); m_sel = model; } @@ -192,7 +185,7 @@ public class SplitWizard extends SplitPanel { * @param the component to use as the default pane */ public void setDefaultPane(Component c) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); if(m_defaultPane != null) { throw new IllegalStateException("Default pane has already been set"); @@ -262,7 +255,7 @@ public class SplitWizard extends SplitPanel { */ public HeaderPanel(String label, Component c) { super(VERTICAL); - setBorder(false); + setBorder(0); m_label = new Label(label); m_label.setFontWeight(Label.BOLD); diff --git a/ccm-core/src/com/arsdigita/bebop/TabbedPane.java b/ccm-core/src/com/arsdigita/bebop/TabbedPane.java index a2cb5e0cf..a4514603a 100755 --- a/ccm-core/src/com/arsdigita/bebop/TabbedPane.java +++ b/ccm-core/src/com/arsdigita/bebop/TabbedPane.java @@ -57,7 +57,6 @@ import org.apache.log4j.Logger; * @version $Id: TabbedPane.java 1137 2006-05-10 19:21:49Z apevec $ */ public class TabbedPane extends SimpleContainer { - public static final String versionId = "$Id: TabbedPane.java 1137 2006-05-10 19:21:49Z apevec $ by $Author: apevec $, $DateTime: 2004/08/16 18:10:38 $"; private static final String CURRENT_PANE = "pane"; /** @@ -87,7 +86,7 @@ public class TabbedPane extends SimpleContainer { * @pre p != null */ public void register(Page p) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); p.addComponentStateParam(this, m_currentPaneParam); // if there is no default pane, then set it to the first one @@ -135,7 +134,7 @@ public class TabbedPane extends SimpleContainer { * @pre label != null && c != null */ public void addTab(Component label, Component c) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); super.add(new Pane(label, c)); } @@ -161,7 +160,7 @@ public class TabbedPane extends SimpleContainer { * @see #respond respond */ public void addActionListener(ActionListener l) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); if ( m_actionListeners == null ) { m_actionListeners = new ArrayList(); } @@ -174,7 +173,7 @@ public class TabbedPane extends SimpleContainer { * @see #addActionListener addActionListener */ public void removeActionListener(ActionListener l) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); if ( m_actionListeners == null ) { return; } @@ -221,7 +220,7 @@ public class TabbedPane extends SimpleContainer { */ public void setDefaultPane(Component pane) throws IllegalArgumentException { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); setDefaultPaneIndex(findPaneSafe(pane)); } diff --git a/ccm-core/src/com/arsdigita/bebop/Table.java b/ccm-core/src/com/arsdigita/bebop/Table.java index 37ae56400..2f8635e98 100755 --- a/ccm-core/src/com/arsdigita/bebop/Table.java +++ b/ccm-core/src/com/arsdigita/bebop/Table.java @@ -84,14 +84,14 @@ import javax.servlet.ServletException; * selected row is identified by a string key and the selected column * is identified by an integer. * + * @see TableModel + * @see TableColumnModel + * * @author David Lutterkort * @version $Id: Table.java 1638 2007-09-17 11:48:34Z chrisg23 $ - * @see TableModel - * @see TableColumnModel */ + */ public class Table extends BlockStylable implements BebopConstants { - public static final String versionId = "$Id: Table.java 1638 2007-09-17 11:48:34Z chrisg23 $ by $Author: chrisg23 $, $DateTime: 2004/08/16 18:10:38 $"; - // Names for HTML Attributes private static final String WIDTH = "width"; private static final String CELL_SPACING = "cellspacing"; @@ -199,7 +199,7 @@ public class Table extends BlockStylable implements BebopConstants { * @param l the {@link TableActionListener} to be added */ public void addTableActionListener(TableActionListener l) { - Assert.unlocked(this); + Assert.isUnlocked(this); if ( m_headerForward == null ) { m_headerForward = createTableActionListener(); if ( m_header != null ) { @@ -216,7 +216,7 @@ public class Table extends BlockStylable implements BebopConstants { * @param l the {@link TableActionListener} to be removed */ public void removeTableActionListener(TableActionListener l) { - Assert.unlocked(this); + Assert.isUnlocked(this); m_listeners.remove(TableActionListener.class, l); } @@ -294,7 +294,7 @@ public class Table extends BlockStylable implements BebopConstants { * @param v the new {@link TableColumnModel} */ public void setColumnModel(TableColumnModel v) { - Assert.unlocked(this); + Assert.isUnlocked(this); m_columnModel = v; } @@ -311,7 +311,7 @@ public class Table extends BlockStylable implements BebopConstants { * @param v the new {@link TableModelBuilder} */ public void setModelBuilder(TableModelBuilder v) { - Assert.unlocked(this); + Assert.isUnlocked(this); m_modelBuilder = v; } @@ -330,7 +330,7 @@ public class Table extends BlockStylable implements BebopConstants { * hidden. */ public void setHeader(TableHeader v) { - Assert.unlocked(this); + Assert.isUnlocked(this); if ( m_headerForward != null ) { if ( m_header != null ) { m_header.removeTableActionListener(m_headerForward); @@ -380,7 +380,7 @@ public class Table extends BlockStylable implements BebopConstants { * @param v a {@link SingleSelectionModel} */ public void setRowSelectionModel(SingleSelectionModel v) { - Assert.unlocked(this); + Assert.isUnlocked(this); m_rowSelectionModel = v; } @@ -400,7 +400,7 @@ public class Table extends BlockStylable implements BebopConstants { * @param v a {@link SingleSelectionModel} */ public void setColumnSelectionModel(SingleSelectionModel v) { - Assert.unlocked(this); + Assert.isUnlocked(this); // TODO: make sure table gets notified of changes getColumnModel().setSelectionModel(v); } diff --git a/ccm-core/src/com/arsdigita/bebop/TextStylable.java b/ccm-core/src/com/arsdigita/bebop/TextStylable.java index db7b60fcb..ee47e010d 100755 --- a/ccm-core/src/com/arsdigita/bebop/TextStylable.java +++ b/ccm-core/src/com/arsdigita/bebop/TextStylable.java @@ -28,8 +28,6 @@ import com.arsdigita.bebop.util.Color; * */ abstract public class TextStylable extends SimpleComponent { - public static final String versionId = "$Id: TextStylable.java 287 2005-02-22 00:29:02Z sskracic $ by $Author: sskracic $, $DateTime: 2004/08/16 18:10:38 $"; - /** * Sets a component's foreground or text color. * diff --git a/ccm-core/src/com/arsdigita/bebop/ToggleLink.java b/ccm-core/src/com/arsdigita/bebop/ToggleLink.java index 72adbc7ae..a9aefc44c 100755 --- a/ccm-core/src/com/arsdigita/bebop/ToggleLink.java +++ b/ccm-core/src/com/arsdigita/bebop/ToggleLink.java @@ -37,10 +37,6 @@ import org.apache.log4j.Logger; * @version $Id: ToggleLink.java 287 2005-02-22 00:29:02Z sskracic $ */ public class ToggleLink extends ControlLink { - public static final String versionId = - "$Id: ToggleLink.java 287 2005-02-22 00:29:02Z sskracic $" + - "$Author: sskracic $" + - "$DateTime: 2004/08/16 18:10:38 $"; private static final Logger s_log = Logger.getLogger(ToggleLink.class); @@ -196,7 +192,7 @@ public class ToggleLink extends ControlLink { * @pre ! isLocked() */ public void setSelectedComponent(Component v) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); m_selectedComponent = v; } diff --git a/ccm-core/src/com/arsdigita/bebop/Tree.java b/ccm-core/src/com/arsdigita/bebop/Tree.java index aa5d47b32..3f62dc2f5 100755 --- a/ccm-core/src/com/arsdigita/bebop/Tree.java +++ b/ccm-core/src/com/arsdigita/bebop/Tree.java @@ -53,10 +53,6 @@ import org.apache.log4j.Logger; * @version $Id: Tree.java 1326 2006-09-22 08:26:24Z sskracic $ */ public class Tree extends SimpleComponent implements Resettable { - public static final String versionId = - "$Id: Tree.java 1326 2006-09-22 08:26:24Z sskracic $" + - "$Author: sskracic $" + - "$DateTime: 2004/08/16 18:10:38 $"; private static final Logger s_log = Logger.getLogger(Tree.class); @@ -141,7 +137,7 @@ public class Tree extends SimpleComponent implements Resettable { * Registers the two parameters to the page. */ public void register(Page p) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); p.addComponent(this); p.addComponentStateParam(this, m_currentState); @@ -190,7 +186,7 @@ public class Tree extends SimpleComponent implements Resettable { * @param b the new {@link TreeModelBuilder} for the tree */ public void setModelBuilder(TreeModelBuilder b) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); m_builder = b; } @@ -202,7 +198,7 @@ public class Tree extends SimpleComponent implements Resettable { * @see TreeModel */ public void setTreeModel(TreeModel m) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); m_tree = m; } @@ -214,7 +210,7 @@ public class Tree extends SimpleComponent implements Resettable { * @param m the new selection model */ public void setSelectionModel(SingleSelectionModel m) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); m_selection = m; s_log.debug("New model: " + m); } @@ -317,7 +313,7 @@ public class Tree extends SimpleComponent implements Resettable { * @pre ! isLocked() */ public void addChangeListener(ChangeListener l) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); if ( m_changeListener == null ) { m_changeListener = createChangeListener(); @@ -339,7 +335,7 @@ public class Tree extends SimpleComponent implements Resettable { * @param l the change listener to remove from the tree */ public void removeChangeListener(ChangeListener l) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); if (s_log.isDebugEnabled()) { s_log.debug("Removing listener " + l + " from " + this); @@ -378,7 +374,7 @@ public class Tree extends SimpleComponent implements Resettable { * @pre ! isLocked() */ public void addActionListener(ActionListener l) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); m_listeners.add(ActionListener.class, l); } @@ -387,7 +383,7 @@ public class Tree extends SimpleComponent implements Resettable { * @see #addActionListener addActionListener */ public void removeActionListener(ActionListener l) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); m_listeners.remove(ActionListener.class, l); } @@ -420,7 +416,7 @@ public class Tree extends SimpleComponent implements Resettable { * @pre ! isLocked() */ public void addTreeExpansionListener(TreeExpansionListener l) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); m_listeners.add(TreeExpansionListener.class, l); } @@ -431,7 +427,7 @@ public class Tree extends SimpleComponent implements Resettable { * @see #addTreeExpansionListener addTreeExpansionListener */ public void removeTreeExpansionListener(TreeExpansionListener l) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); m_listeners.remove(TreeExpansionListener.class, l); } @@ -532,8 +528,8 @@ public class Tree extends SimpleComponent implements Resettable { * @pre data != null */ public void collapse(String nodeKey, PageState data) { - Assert.assertNotNull(nodeKey); - Assert.assertNotNull(data); + Assert.exists(nodeKey); + Assert.exists(data); StringBuffer newCurrentState = new StringBuffer(""); String stateString = (String) data.getValue(m_currentState); @@ -568,8 +564,8 @@ public class Tree extends SimpleComponent implements Resettable { * @pre data != null */ public void expand(String nodeKey, PageState data) { - Assert.assertNotNull(nodeKey); - Assert.assertNotNull(data); + Assert.exists(nodeKey); + Assert.exists(data); String stateString = (String) data.getValue(m_currentState); String spaceId = " " + nodeKey + " "; @@ -615,7 +611,7 @@ public class Tree extends SimpleComponent implements Resettable { * @param r a TreeCellRenderer value */ public void setCellRenderer(TreeCellRenderer r) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); m_renderer = r; } diff --git a/ccm-core/src/com/arsdigita/bebop/Wizard.java b/ccm-core/src/com/arsdigita/bebop/Wizard.java index 06b652c92..8f92775ae 100755 --- a/ccm-core/src/com/arsdigita/bebop/Wizard.java +++ b/ccm-core/src/com/arsdigita/bebop/Wizard.java @@ -94,12 +94,12 @@ import com.arsdigita.bebop.util.Traversal; * * Also, allow to jump to a specific step (useful for providing quick * links on a confirmation step in a wizard with several steps) + * + * @version $Id: Wizard.java 1414 2006-12-07 14:24:10Z chrisgilbert23 $ **/ public class Wizard extends MultiStepForm { - public final static String versionId = "$Id: Wizard.java 1414 2006-12-07 14:24:10Z chrisgilbert23 $ by $Author: chrisgilbert23 $, $DateTime: 2004/08/16 18:10:38 $"; - private static Logger s_log = Logger.getLogger(Wizard.class); private ModalContainer m_steps = new ModalContainer(); @@ -198,18 +198,17 @@ public class Wizard extends MultiStepForm { if (!m_quickFinish) { p.setVisibleDefault(m_finish, false); } - Traversal trav = new Traversal () { - protected void act(Component c) { - if (c instanceof Widget) { - ((Widget) c).setValidationGuard( - new Widget.ValidationGuard() { - public boolean shouldValidate(PageState ps) { - return m_back.isSelected(ps); - } - }); - } + Traversal trav = new Traversal () { + protected void act(Component c) { + if (c instanceof Widget) { + ((Widget) c).setValidationGuard(new Widget.ValidationGuard() { + public boolean shouldValidate(PageState ps) { + return m_back.isSelected(ps); + } + }); } - }; + } + }; trav.preorder(this); } @@ -336,8 +335,9 @@ public class Wizard extends MultiStepForm { private class SkipStepListener implements ChangeListener { public void stateChanged(ChangeEvent e) { PageState state = e.getPageState(); - s_log.debug("state of underlying modal container changed - new visible component is " - + m_steps.indexOf(m_steps.getVisibleComponent(state))); + s_log.debug("state of underlying modal container changed - " + + "new visible component is " + + m_steps.indexOf(m_steps.getVisibleComponent(state))); Component newComponent = m_steps.getVisibleComponent(state); if (((Set) m_hiddenSteps.get(state)).contains(newComponent)) { s_log.debug("I'm going to skip this step"); diff --git a/ccm-core/src/com/arsdigita/bebop/demo/workflow/AddTask.java b/ccm-core/src/com/arsdigita/bebop/demo/workflow/AddTask.java index 6ec273106..103b4b72e 100755 --- a/ccm-core/src/com/arsdigita/bebop/demo/workflow/AddTask.java +++ b/ccm-core/src/com/arsdigita/bebop/demo/workflow/AddTask.java @@ -80,7 +80,7 @@ public class AddTask extends Form Label t = (Label) e.getTarget(); PageState s = e.getPageState(); // FIXME: name of template comes from DB - Assert.assertTrue(m_processes.isSelected(s)); + Assert.isTrue(m_processes.isSelected(s)); Process inner_p = SampleProcesses.getProcess(m_processes.getSelectedKey(s)); t.setLabel("Add a new Task to " + inner_p.getName()); diff --git a/ccm-core/src/com/arsdigita/bebop/demo/workflow/ProcessDisplay.java b/ccm-core/src/com/arsdigita/bebop/demo/workflow/ProcessDisplay.java index f1ad5ac63..7ab7ad75b 100755 --- a/ccm-core/src/com/arsdigita/bebop/demo/workflow/ProcessDisplay.java +++ b/ccm-core/src/com/arsdigita/bebop/demo/workflow/ProcessDisplay.java @@ -157,7 +157,7 @@ public class ProcessDisplay extends BoxPanel private boolean m_locked; public TableModel makeModel(final Table t, final PageState s) { - Assert.assertTrue(m_processes.isSelected(s)); + Assert.isTrue(m_processes.isSelected(s)); return new TableModel() { private Process p = @@ -221,7 +221,7 @@ public class ProcessDisplay extends BoxPanel public void prepare(PrintEvent e) { Label t = (Label) e.getTarget(); PageState s = e.getPageState(); - Assert.assertTrue(m_processes.isSelected(s)); + Assert.isTrue(m_processes.isSelected(s)); Process p = SampleProcesses.getProcess(m_processes.getSelectedKey(s)); t.setLabel("

Details for " diff --git a/ccm-core/src/com/arsdigita/bebop/form/Date.java b/ccm-core/src/com/arsdigita/bebop/form/Date.java index 4fcd9ad94..4e5c6adc2 100755 --- a/ccm-core/src/com/arsdigita/bebop/form/Date.java +++ b/ccm-core/src/com/arsdigita/bebop/form/Date.java @@ -185,7 +185,7 @@ public class Date extends Widget implements BebopConstants { } public void setYearRange(int startYear, int endYear) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); m_year.clearOptions(); for (int j= startYear; j<=endYear; j+=1) { m_year.addOption(new Option(String.valueOf(j))); @@ -265,7 +265,7 @@ public class Date extends Widget implements BebopConstants { } public Object getFragmentValue(PageState ps, int field) { - Assert.assertNotNull(ps, "PageState"); + Assert.exists(ps, "PageState"); FormData f = getForm().getFormData(ps); if (f != null) { java.util.Date value = (java.util.Date)f.get(getName()); diff --git a/ccm-core/src/com/arsdigita/bebop/form/DateTime.java b/ccm-core/src/com/arsdigita/bebop/form/DateTime.java index abbb27bd7..a9d7749b4 100755 --- a/ccm-core/src/com/arsdigita/bebop/form/DateTime.java +++ b/ccm-core/src/com/arsdigita/bebop/form/DateTime.java @@ -318,7 +318,7 @@ public class DateTime extends Widget implements BebopConstants { } public void setYearRange(int startYear, int endYear) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); m_year.clearOptions(); for (int j= startYear; j<=endYear; j+=1) { m_year.addOption(new Option(String.valueOf(j))); @@ -416,7 +416,7 @@ public class DateTime extends Widget implements BebopConstants { } private Object getFragmentValue(PageState ps, int field) { - Assert.assertNotNull(ps, "PageState"); + Assert.exists(ps, "PageState"); FormData f = getForm().getFormData(ps); if (f != null) { java.util.Date value = (java.util.Date)f.get(getName()); diff --git a/ccm-core/src/com/arsdigita/bebop/form/MultipleSelectPairWidget.java b/ccm-core/src/com/arsdigita/bebop/form/MultipleSelectPairWidget.java index 38788b2f5..566424048 100755 --- a/ccm-core/src/com/arsdigita/bebop/form/MultipleSelectPairWidget.java +++ b/ccm-core/src/com/arsdigita/bebop/form/MultipleSelectPairWidget.java @@ -512,7 +512,7 @@ public class MultipleSelectPairWidget extends FormStep { String[] addOptionsForHidden = EMPTY_STRING_ARRAY; String[] removeOptionsForHidden = EMPTY_STRING_ARRAY; - Assert.assertNotNull(m_addSelectDataSource, + Assert.exists(m_addSelectDataSource, "You must provide some options for the " + "user to choose!"); diff --git a/ccm-core/src/com/arsdigita/bebop/form/Option.java b/ccm-core/src/com/arsdigita/bebop/form/Option.java index 6aced3cac..31f2da3c0 100755 --- a/ccm-core/src/com/arsdigita/bebop/form/Option.java +++ b/ccm-core/src/com/arsdigita/bebop/form/Option.java @@ -97,7 +97,7 @@ public class Option extends BlockStylable { } public final void setComponent(Component component) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); m_component = component; } @@ -106,8 +106,8 @@ public class Option extends BlockStylable { } public final void setGroup(OptionGroup group) { - Assert.assertNotLocked(this); - Assert.assertNotNull(group); + Assert.isUnlocked(this); + Assert.exists(group); m_group = group; m_isSelectOption = BebopConstants.BEBOP_OPTION.equals(m_group.m_xmlElement); diff --git a/ccm-core/src/com/arsdigita/bebop/form/OptionGroup.java b/ccm-core/src/com/arsdigita/bebop/form/OptionGroup.java index 2433d639b..c559d7463 100755 --- a/ccm-core/src/com/arsdigita/bebop/form/OptionGroup.java +++ b/ccm-core/src/com/arsdigita/bebop/form/OptionGroup.java @@ -121,7 +121,7 @@ public abstract class OptionGroup extends Widget } public void clearOptions() { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); m_options = new ArrayList(); } @@ -152,7 +152,7 @@ public abstract class OptionGroup extends Widget public void addOption(Option opt, PageState ps) { ArrayList list = m_options; if (ps == null) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); } else { list = (ArrayList)m_requestOptions.get(ps); } @@ -164,7 +164,7 @@ public abstract class OptionGroup extends Widget public void removeOption(Option opt, PageState ps) { ArrayList list = m_options; if (ps == null) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); } else { list = (ArrayList)m_requestOptions.get(ps); } @@ -176,7 +176,7 @@ public abstract class OptionGroup extends Widget } /** - * Removes the first option whose key is equal + * Removes the first option whose key is isEqual * to the key that is passed in. */ public void removeOption(String key, PageState ps) { @@ -184,7 +184,7 @@ public abstract class OptionGroup extends Widget // efficient solution is to switch to using a HashMap. ArrayList list = m_options; if (ps == null) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); } else { list = (ArrayList)m_requestOptions.get(ps); } @@ -210,7 +210,7 @@ public abstract class OptionGroup extends Widget * this is 1 then a TextField is used. Otherwise a TextArea is used. */ public void addOtherOption( String label, int width, int height ) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); Option otherOption = new Option( OTHER_OPTION, label ); addOption( otherOption ); @@ -283,11 +283,11 @@ public abstract class OptionGroup extends Widget * @param value the value of the option to be added to the * by-default-selected set. */ public void setOptionSelected(String value) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); if (!isMultiple()) { // only one option may be selected // to this selected list better be empty - Assert.assertTrue(m_selected.size() == 0, TOO_MANY_OPTIONS_SELECTED); + Assert.isTrue(m_selected.size() == 0, TOO_MANY_OPTIONS_SELECTED); m_selected.add(value); getParameterModel().setDefaultValue( value ); } else { diff --git a/ccm-core/src/com/arsdigita/bebop/form/Submit.java b/ccm-core/src/com/arsdigita/bebop/form/Submit.java index ff591be1c..b49d7ec34 100755 --- a/ccm-core/src/com/arsdigita/bebop/form/Submit.java +++ b/ccm-core/src/com/arsdigita/bebop/form/Submit.java @@ -151,7 +151,7 @@ public class Submit extends Widget { * @param buttonLabel The label that shows up on the button. */ public void setButtonLabel(GlobalizedMessage buttonLabel) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); m_buttonLabel = buttonLabel; } diff --git a/ccm-core/src/com/arsdigita/bebop/form/Time.java b/ccm-core/src/com/arsdigita/bebop/form/Time.java index 72c5267f8..0909d3685 100755 --- a/ccm-core/src/com/arsdigita/bebop/form/Time.java +++ b/ccm-core/src/com/arsdigita/bebop/form/Time.java @@ -289,7 +289,7 @@ public class Time extends Widget implements BebopConstants } private Object getFragmentValue(PageState ps, int field) { - Assert.assertNotNull(ps, "PageState"); + Assert.exists(ps, "PageState"); FormData f = getForm().getFormData(ps); if (f != null) { java.util.Date value = (java.util.Date)f.get(getName()); diff --git a/ccm-core/src/com/arsdigita/bebop/form/Widget.java b/ccm-core/src/com/arsdigita/bebop/form/Widget.java index 283ee579f..acc9e4478 100755 --- a/ccm-core/src/com/arsdigita/bebop/form/Widget.java +++ b/ccm-core/src/com/arsdigita/bebop/form/Widget.java @@ -137,7 +137,7 @@ public abstract class Widget extends BlockStylable implements Cloneable, BebopCo } public void setValidateInvisible(boolean value) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); m_validateInvisible = value; } @@ -147,7 +147,7 @@ public abstract class Widget extends BlockStylable implements Cloneable, BebopCo protected void fireValidation(ParameterEvent evt) throws FormProcessException { - Assert.assertLocked(this); + Assert.isLocked(this); PageState ps = evt.getPageState(); @@ -164,8 +164,8 @@ public abstract class Widget extends BlockStylable implements Cloneable, BebopCo } public void addValidationListener(ParameterListener listener) { - Assert.assertNotNull(listener, "ParameterListener"); - Assert.assertNotLocked(this); + Assert.exists(listener, "ParameterListener"); + Assert.isUnlocked(this); if (m_forwardParameter == null) { m_forwardParameter = createParameterListener(); m_parameterModel.addParameterListener(m_forwardParameter); @@ -174,8 +174,8 @@ public abstract class Widget extends BlockStylable implements Cloneable, BebopCo } public void removeValidationListener(ParameterListener listener) { - Assert.assertNotNull(listener, "ParameterListener"); - Assert.assertNotLocked(this); + Assert.exists(listener, "ParameterListener"); + Assert.isUnlocked(this); m_listeners.remove(ParameterListener.class, listener); } @@ -186,7 +186,7 @@ public abstract class Widget extends BlockStylable implements Cloneable, BebopCo * @return true if subtype is in the list */ public boolean hasValidationListener(ParameterListener listener) { - Assert.assertNotNull(listener, "ParameterListener"); + Assert.exists(listener, "ParameterListener"); return this.getParameterModel().hasParameterListener(listener); // return (m_listeners.getListenerCount(listener.getClass()) > 0); @@ -361,7 +361,7 @@ public abstract class Widget extends BlockStylable implements Cloneable, BebopCo * This method can only be called on unlocked widgets. */ public void setReadOnly() { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); setAttribute("readonly", "readonly"); } @@ -373,7 +373,7 @@ public abstract class Widget extends BlockStylable implements Cloneable, BebopCo * on unlocked widgets. */ public void setDisabled() { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); setAttribute("disabled", "disabled"); } @@ -381,7 +381,7 @@ public abstract class Widget extends BlockStylable implements Cloneable, BebopCo * Sets a popup hint for the widget */ public void setHint(String hint) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); setAttribute("title", hint); } @@ -429,7 +429,7 @@ public abstract class Widget extends BlockStylable implements Cloneable, BebopCo * @param v true if this parameter is a pass in parameter. */ public final void setPassIn(boolean v) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); getParameterModel().setPassIn(v); } @@ -439,7 +439,7 @@ public abstract class Widget extends BlockStylable implements Cloneable, BebopCo * listeners will be lost. */ public final void setParameterModel(ParameterModel parameterModel) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); m_parameterModel = parameterModel; } @@ -596,7 +596,7 @@ public abstract class Widget extends BlockStylable implements Cloneable, BebopCo */ public void setValue(PageState ps, Object value) throws IllegalStateException { - Assert.assertNotNull(ps, "PageState"); + Assert.exists(ps, "PageState"); ParameterData p = getParameterData(ps); // set value in session if it is being held - allows // updates in wizard forms where init is not called each @@ -617,7 +617,7 @@ public abstract class Widget extends BlockStylable implements Cloneable, BebopCo } protected Iterator getErrors(PageState ps) { - Assert.assertNotNull(ps, "PageState"); + Assert.exists(ps, "PageState"); FormData f = getForm().getFormData(ps); if (f!=null) { return f.getErrors(getName()); @@ -630,7 +630,7 @@ public abstract class Widget extends BlockStylable implements Cloneable, BebopCo * @post returns null if the FormData are missing */ protected ParameterData getParameterData(PageState ps) { - Assert.assertNotNull(ps, "PageState"); + Assert.exists(ps, "PageState"); FormData fd = getForm().getFormData(ps); if (fd != null) { return fd.getParameter(getName()); @@ -665,7 +665,7 @@ public abstract class Widget extends BlockStylable implements Cloneable, BebopCo * @param guard the Widget.ValidationGuard. */ public void setValidationGuard(ValidationGuard guard) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); m_guard = guard; } diff --git a/ccm-core/src/com/arsdigita/bebop/jsp/JspWrapperException.java b/ccm-core/src/com/arsdigita/bebop/jsp/JspWrapperException.java index 65f467a56..f51ae6013 100755 --- a/ccm-core/src/com/arsdigita/bebop/jsp/JspWrapperException.java +++ b/ccm-core/src/com/arsdigita/bebop/jsp/JspWrapperException.java @@ -52,7 +52,7 @@ public class JspWrapperException extends RuntimeException { */ public JspWrapperException (String s, Throwable rootCause) { super(s); - Assert.assertNotNull(rootCause); + Assert.exists(rootCause); this.m_rootCause = rootCause; } diff --git a/ccm-core/src/com/arsdigita/bebop/page/BebopApplicationServlet.java b/ccm-core/src/com/arsdigita/bebop/page/BebopApplicationServlet.java index d04d701fb..78ea2098f 100755 --- a/ccm-core/src/com/arsdigita/bebop/page/BebopApplicationServlet.java +++ b/ccm-core/src/com/arsdigita/bebop/page/BebopApplicationServlet.java @@ -70,7 +70,7 @@ public class BebopApplicationServlet extends BaseApplicationServlet { final Page page) { Assert.exists(pathInfo, String.class); Assert.exists(page, Page.class); - Assert.truth(pathInfo.startsWith("/"), "path starts with '/'"); + Assert.isTrue(pathInfo.startsWith("/"), "path starts with '/'"); m_pages.put(pathInfo, page); } @@ -81,7 +81,7 @@ public class BebopApplicationServlet extends BaseApplicationServlet { */ protected final void disableClientCaching(String pathInfo) { Assert.exists(pathInfo, String.class); - Assert.truth(m_pages.containsKey(pathInfo), "Page " + pathInfo + " has not been put in servlet"); + Assert.isTrue(m_pages.containsKey(pathInfo), "Page " + pathInfo + " has not been put in servlet"); m_clientCacheDisabledPages.add(pathInfo); } @@ -91,7 +91,7 @@ public class BebopApplicationServlet extends BaseApplicationServlet { throws ServletException, IOException { final String pathInfo = sreq.getPathInfo(); - Assert.assertNotNull(pathInfo, "String pathInfo"); + Assert.exists(pathInfo, "String pathInfo"); final Page page = (Page) m_pages.get(pathInfo); diff --git a/ccm-core/src/com/arsdigita/bebop/parameters/ArrayParameter.java b/ccm-core/src/com/arsdigita/bebop/parameters/ArrayParameter.java index b1498f3f6..5a23dea05 100755 --- a/ccm-core/src/com/arsdigita/bebop/parameters/ArrayParameter.java +++ b/ccm-core/src/com/arsdigita/bebop/parameters/ArrayParameter.java @@ -102,7 +102,7 @@ public class ArrayParameter extends ParameterModel { * @param v the parameter model for entries in the array. */ public final void setElementParameter(ParameterModel v) { - Assert.unlocked(this); + Assert.isUnlocked(this); m_element = v; setName(v.getName()); } diff --git a/ccm-core/src/com/arsdigita/bebop/parameters/ParameterModel.java b/ccm-core/src/com/arsdigita/bebop/parameters/ParameterModel.java index 8af80cc32..480a9ea6c 100755 --- a/ccm-core/src/com/arsdigita/bebop/parameters/ParameterModel.java +++ b/ccm-core/src/com/arsdigita/bebop/parameters/ParameterModel.java @@ -57,7 +57,7 @@ public abstract class ParameterModel implements Lockable { */ protected List m_parameterListeners; /** - * A boolean indicating if this ParameterModel is locked, as per the + * A boolean indicating if this ParameterModel is isLocked, as per the * Lockable interface */ protected boolean m_locked; @@ -93,8 +93,8 @@ public abstract class ParameterModel implements Lockable { */ protected ParameterModel(String name) { this(); - Assert.assertNotLocked(this); - Assert.assertNotNull(name, "Name"); + Assert.isUnlocked(this); + Assert.exists(name, "Name"); Assert.assertNotEmpty(name, "Name"); m_name = name; } @@ -120,7 +120,7 @@ public abstract class ParameterModel implements Lockable { * @see #setDefaultValue */ public void setDefaultOverridesNull(boolean v) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); m_defaultOverridesNull = v; } @@ -154,7 +154,7 @@ public abstract class ParameterModel implements Lockable { * @param v true if this parameter is a pass in parameter. */ public void setPassIn(boolean v) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); m_passIn = v; } @@ -183,12 +183,12 @@ public abstract class ParameterModel implements Lockable { /** * Sets the name of this ParmeterModel. - * Asserts that this ParameterModel is not locked. + * Asserts that this ParameterModel is not isLocked. * * @param name The name of this parameter model. */ public void setName(String name) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); m_name = name; } @@ -196,13 +196,13 @@ public abstract class ParameterModel implements Lockable { * Adds a validation listener, implementing a custom validation * check that applies to this Parameter. Useful for checks that * require examination of the values of only this parameter. - * Asserts that this ParameterModel is not locked. + * Asserts that this ParameterModel is not isLocked. * * @param listener An instance of a class that implements the * FormValidationListener interface. */ public void addParameterListener(ParameterListener listener) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); m_parameterListeners.add(listener); } @@ -210,14 +210,14 @@ public abstract class ParameterModel implements Lockable { * Sets a default value for this parameter. This default value is * superceded by values set in the initialization listeners and in * the request object. - * Asserts that this ParameterModel is not locked. + * Asserts that this ParameterModel is not isLocked. * * @param defaultValue a default value for this parameter that * appears if there is no value in the request or specified by an * initialization listener */ public void setDefaultValue(Object defaultValue) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); m_defaultValue = defaultValue; } @@ -382,7 +382,7 @@ public abstract class ParameterModel implements Lockable { /** * Lock the model, blocking any further modifications. Cached form - * models should always be locked to ensure that they remain + * models should always be isLocked to ensure that they remain * unchanged across requests. */ public synchronized void lock() { @@ -401,7 +401,7 @@ public abstract class ParameterModel implements Lockable { */ public void validate(ParameterData data) throws FormProcessException { - Assert.assertLocked(this); + Assert.isLocked(this); ParameterEvent e = null; @@ -459,7 +459,7 @@ public abstract class ParameterModel implements Lockable { } /** - * @return true if this ParameterModel is locked to prevent + * @return true if this ParameterModel is isLocked to prevent * modification. */ public boolean isLocked() { diff --git a/ccm-core/src/com/arsdigita/bebop/parameters/StringInRangeValidationListener.java b/ccm-core/src/com/arsdigita/bebop/parameters/StringInRangeValidationListener.java index 28c30d3a2..fbc5ed82a 100755 --- a/ccm-core/src/com/arsdigita/bebop/parameters/StringInRangeValidationListener.java +++ b/ccm-core/src/com/arsdigita/bebop/parameters/StringInRangeValidationListener.java @@ -118,8 +118,8 @@ public class StringInRangeValidationListener extends GlobalizedParameterListener * @param maxLength */ private static void validateRange(int minLength, int maxLength) { - Assert.truth(minLength >= 0, "Minimum length cannot be negative!"); - Assert.truth(maxLength > minLength, "Maximum length must be greater than minimum!"); + Assert.isTrue(minLength >= 0, "Minimum length cannot be negative!"); + Assert.isTrue(maxLength > minLength, "Maximum length must be greater than minimum!"); } diff --git a/ccm-core/src/com/arsdigita/bebop/parameters/StringLengthValidationListener.java b/ccm-core/src/com/arsdigita/bebop/parameters/StringLengthValidationListener.java index 7b685f538..ae1a82341 100755 --- a/ccm-core/src/com/arsdigita/bebop/parameters/StringLengthValidationListener.java +++ b/ccm-core/src/com/arsdigita/bebop/parameters/StringLengthValidationListener.java @@ -26,7 +26,7 @@ import com.arsdigita.util.Assert; /** * Verifies that the - * string length is less than or equal to the specified value + * string length is less than or isEqual to the specified value * * @author Stanislav Freidin * @version $Revision: #10 $ $Author: sskracic $ $DateTime: 2004/08/16 18:10:38 $ @@ -43,7 +43,7 @@ public class StringLengthValidationListener implements ParameterListener { public static final StringLengthValidationListener FOUR_K = new StringLengthValidationListener(4000); public StringLengthValidationListener(final int maxLength) { - Assert.truth(maxLength > 0, "Max length must be greater than 0"); + Assert.isTrue(maxLength > 0, "Max length must be greater than 0"); m_maxLength = maxLength; m_errHead = "The following strings are longer than " + maxLength + " characters: "; diff --git a/ccm-core/src/com/arsdigita/bebop/table/DefaultTableCellRenderer.java b/ccm-core/src/com/arsdigita/bebop/table/DefaultTableCellRenderer.java index 1d7642e21..b97852afa 100755 --- a/ccm-core/src/com/arsdigita/bebop/table/DefaultTableCellRenderer.java +++ b/ccm-core/src/com/arsdigita/bebop/table/DefaultTableCellRenderer.java @@ -113,7 +113,7 @@ public class DefaultTableCellRenderer extends LockableImpl * @pre ! isLocked() */ public void setActive(boolean v) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); m_active = v; } diff --git a/ccm-core/src/com/arsdigita/bebop/table/DefaultTableColumnModel.java b/ccm-core/src/com/arsdigita/bebop/table/DefaultTableColumnModel.java index e44c51983..09785223d 100755 --- a/ccm-core/src/com/arsdigita/bebop/table/DefaultTableColumnModel.java +++ b/ccm-core/src/com/arsdigita/bebop/table/DefaultTableColumnModel.java @@ -67,12 +67,12 @@ public class DefaultTableColumnModel implements TableColumnModel { } public void add(TableColumn column) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); m_columns.add(column); } public void add(int columnIndex, TableColumn column) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); m_columns.add(columnIndex, column); } @@ -106,7 +106,7 @@ public class DefaultTableColumnModel implements TableColumnModel { } public void remove(TableColumn column) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); m_columns.remove(column); } @@ -115,7 +115,7 @@ public class DefaultTableColumnModel implements TableColumnModel { } public void setSelectionModel(SingleSelectionModel model) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); m_selection = model; } diff --git a/ccm-core/src/com/arsdigita/bebop/table/TableColumn.java b/ccm-core/src/com/arsdigita/bebop/table/TableColumn.java index 53e42f5a8..9dd6d3459 100755 --- a/ccm-core/src/com/arsdigita/bebop/table/TableColumn.java +++ b/ccm-core/src/com/arsdigita/bebop/table/TableColumn.java @@ -116,7 +116,7 @@ public class TableColumn extends SimpleComponent /** * Creates a new table column with modelIndex 0 and header - * value and key equal to null. + * value and key isEqual to null. */ public TableColumn() { this(0); @@ -124,7 +124,7 @@ public class TableColumn extends SimpleComponent /** * Creates a new table column with the given modelIndex and - * header value and key equal to null. + * header value and key isEqual to null. * * @param modelIndex the index of the column in the table model from * which to retrieve values @@ -136,7 +136,7 @@ public class TableColumn extends SimpleComponent /** * Creates a new table column with the given modelIndex and - * header value. The header key is equal to null. + * header value. The header key is isEqual to null. * * @param modelIndex the index of the column in the table model from * which to retrieve values. @@ -188,7 +188,7 @@ public class TableColumn extends SimpleComponent * @see #getCellRenderer */ public void setHeaderRenderer(TableCellRenderer v) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); m_headerRenderer = v; } @@ -212,7 +212,7 @@ public class TableColumn extends SimpleComponent * @see #getHeaderRenderer */ public void setCellRenderer(TableCellRenderer v) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); m_cellRenderer = v; } @@ -234,7 +234,7 @@ public class TableColumn extends SimpleComponent * @see #getHeaderValue */ public void setHeaderValue(Object value) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); m_headerValue = value; } @@ -256,7 +256,7 @@ public class TableColumn extends SimpleComponent * @see #getHeaderKey */ public void setHeaderKey(Object key) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); m_headerKey = key; } @@ -280,7 +280,7 @@ public class TableColumn extends SimpleComponent * take values. */ public void setModelIndex(int v) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); m_modelIndex = v; } @@ -301,7 +301,7 @@ public class TableColumn extends SimpleComponent * @param v the width of this column */ public void setWidth(String v) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); setAttribute(WIDTH_ATTR, v); } @@ -312,7 +312,7 @@ public class TableColumn extends SimpleComponent * @param v the width of this column */ public void setAlign(String v) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); m_cellAttrs.setAttribute(ALIGN_ATTR, v); } @@ -324,7 +324,7 @@ public class TableColumn extends SimpleComponent * * @param v the width of this column */ public void setHeadAlign(String v) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); setAttribute(ALIGN_ATTR, v); } @@ -335,7 +335,7 @@ public class TableColumn extends SimpleComponent * @param v the width of this column */ public void setVAlign(String v) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); m_cellAttrs.setAttribute(VALIGN_ATTR, v); } @@ -346,7 +346,7 @@ public class TableColumn extends SimpleComponent * * @param v the width of this column */ public void setHeadVAlign(String v) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); setAttribute(VALIGN_ATTR, v); } @@ -362,7 +362,7 @@ public class TableColumn extends SimpleComponent * style attribute of an HTML tag * @see Standard Attributes */ public void setStyleAttr(String style) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); m_cellAttrs.setAttribute(STYLE, style); } @@ -377,7 +377,7 @@ public class TableColumn extends SimpleComponent * style attribute of an HTML tag * @see Standard Attributes */ public void setHeadStyleAttr(String style) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); setAttribute(STYLE, style); } @@ -392,7 +392,7 @@ public class TableColumn extends SimpleComponent * style attribute of an HTML tag * @see Standard Attributes */ public void setClassAttr(String c) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); m_cellAttrs.setAttribute(CLASS, c); } @@ -408,7 +408,7 @@ public class TableColumn extends SimpleComponent * style attribute of an HTML tag * @see Standard Attributes */ public void setHeadClassAttr(String c) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); setAttribute(CLASS, c); } diff --git a/ccm-core/src/com/arsdigita/bebop/table/TableHeader.java b/ccm-core/src/com/arsdigita/bebop/table/TableHeader.java index b6a36b0b0..aff17b9c8 100755 --- a/ccm-core/src/com/arsdigita/bebop/table/TableHeader.java +++ b/ccm-core/src/com/arsdigita/bebop/table/TableHeader.java @@ -87,7 +87,7 @@ public class TableHeader extends SimpleComponent { * @param l the {@link TableActionListener} to add */ public void addTableActionListener(TableActionListener l) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); m_listeners.add(TableActionListener.class, l); } @@ -97,7 +97,7 @@ public class TableHeader extends SimpleComponent { *@param l the {@link TableActionListener} to remove */ public void removeTableActionListener(TableActionListener l) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); m_listeners.remove(TableActionListener.class, l); } @@ -161,7 +161,7 @@ public class TableHeader extends SimpleComponent { * @param v the parent table */ public void setTable(Table v) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); m_table = v; } @@ -178,7 +178,7 @@ public class TableHeader extends SimpleComponent { * @param v the new {@link TableColumnModel} */ public void setColumnModel(TableColumnModel v) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); m_columnModel = v; } @@ -197,7 +197,7 @@ public class TableHeader extends SimpleComponent { * @param v the new default renderer */ public void setDefaultRenderer(TableCellRenderer v) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); m_defaultRenderer = v; } diff --git a/ccm-core/src/com/arsdigita/bebop/util/Attributes.java b/ccm-core/src/com/arsdigita/bebop/util/Attributes.java index 77c2d77e0..185f7598a 100755 --- a/ccm-core/src/com/arsdigita/bebop/util/Attributes.java +++ b/ccm-core/src/com/arsdigita/bebop/util/Attributes.java @@ -51,7 +51,7 @@ public class Attributes implements Lockable, Cloneable { } /** - * Clone the attributes. The clone is not locked and has its own set of + * Clone the attributes. The clone is not isLocked and has its own set of * attributes and values. * @post ! ((Attributes) return).isLocked() */ @@ -75,7 +75,7 @@ public class Attributes implements Lockable, Cloneable { * @param value The value to assign the named attribute */ public void setAttribute(String name, String value) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); name = name.toLowerCase(); m_attributes.put(name, value); } diff --git a/ccm-core/src/com/arsdigita/categorization/Category.java b/ccm-core/src/com/arsdigita/categorization/Category.java index 76abda186..7dc4576a2 100755 --- a/ccm-core/src/com/arsdigita/categorization/Category.java +++ b/ccm-core/src/com/arsdigita/categorization/Category.java @@ -1107,7 +1107,7 @@ public class Category extends ACSObject { addMapping((Category) acsObj, relationType); return; } - Assert.falsity(isAbstract(), + Assert.isFalse(isAbstract(), "You cannot categorize an object " + "within an abstract category. If you are " + "seeing this message then your UI is " + @@ -1662,7 +1662,7 @@ public class Category extends ACSObject { * @pre relation == Category.CHILD || relation == Category.RELATED || relation == Category.PREFERRED */ public DataAssociationCursor getRelatedCategories(String relation) { - Assert.truth(relation.equals(CHILD) || relation.equals(RELATED) + Assert.isTrue(relation.equals(CHILD) || relation.equals(RELATED) || relation.equals(PREFERRED), " invalid relation {" + relation + "}"); DataAssociationCursor cursor = diff --git a/ccm-core/src/com/arsdigita/categorization/CategoryPurpose.java b/ccm-core/src/com/arsdigita/categorization/CategoryPurpose.java index 14447d7da..f4d09a2ad 100755 --- a/ccm-core/src/com/arsdigita/categorization/CategoryPurpose.java +++ b/ccm-core/src/com/arsdigita/categorization/CategoryPurpose.java @@ -368,7 +368,7 @@ public class CategoryPurpose extends ACSObject { */ public static Category getRootCategory(String key) { - Assert.assertTrue(purposeExists(key)); + Assert.isTrue(purposeExists(key)); // get the purpose according to the key Session ssn = SessionManager.getSession(); @@ -377,22 +377,22 @@ public class CategoryPurpose extends ACSObject { keyFilter.set("key", key); // there should be exactly one purpose for this key - Assert.assertTrue(allPurposes.next()); + Assert.isTrue(allPurposes.next()); CategoryPurpose purpose = (CategoryPurpose) DomainObjectFactory.newInstance(allPurposes.getDataObject()); - Assert.assertTrue(!allPurposes.next()); + Assert.isTrue(!allPurposes.next()); // now need to figure out the root category out of all the categories // mapped to this purpose.... (no good way to do this...) I'll do it // by looking for the category that has no parents... Collection categories = purpose.getCategories(); - Assert.assertTrue(!categories.isEmpty(), + Assert.isTrue(!categories.isEmpty(), "Categories collection is empty"); Iterator categoriesIterator = categories.iterator(); Category category; - Assert.assertTrue(categoriesIterator.hasNext(), + Assert.isTrue(categoriesIterator.hasNext(), "can't find core categories"); do { category = (Category)categoriesIterator.next(); diff --git a/ccm-core/src/com/arsdigita/categorization/ui/ACSObjectCategorySummary.java b/ccm-core/src/com/arsdigita/categorization/ui/ACSObjectCategorySummary.java index 11a561d24..9209dfa4e 100755 --- a/ccm-core/src/com/arsdigita/categorization/ui/ACSObjectCategorySummary.java +++ b/ccm-core/src/com/arsdigita/categorization/ui/ACSObjectCategorySummary.java @@ -80,7 +80,7 @@ public abstract class ACSObjectCategorySummary extends SimpleComponent { public void respond(PageState state) throws ServletException { super.respond(state); - Assert.truth(canEdit(state), "User can edit object"); + Assert.isTrue(canEdit(state), "User can edit object"); String name = state.getControlEventName(); ActionListener listener = (ActionListener)m_listeners.get(name); diff --git a/ccm-core/src/com/arsdigita/db/DbHelper.java b/ccm-core/src/com/arsdigita/db/DbHelper.java index 7e0c5140f..30e5a38f3 100755 --- a/ccm-core/src/com/arsdigita/db/DbHelper.java +++ b/ccm-core/src/com/arsdigita/db/DbHelper.java @@ -50,7 +50,7 @@ public class DbHelper { * constants specified in this file. */ public static void setDatabase(int database) { - Assert.assertTrue((database >= DB_DEFAULT) && + Assert.isTrue((database >= DB_DEFAULT) && (database <= DB_MAX)); s_database = database; @@ -112,7 +112,7 @@ public class DbHelper { * files */ public static String getDatabaseDirectory(int database) { - Assert.assertTrue((database >= DB_DEFAULT) && + Assert.isTrue((database >= DB_DEFAULT) && (database <= DB_MAX)); switch (database) { @@ -194,7 +194,7 @@ public class DbHelper { * identifier. */ public static String getDatabaseName(int database) { - Assert.assertTrue((database >= DB_DEFAULT) && + Assert.isTrue((database >= DB_DEFAULT) && (database <= DB_MAX)); switch (database) { diff --git a/ccm-core/src/com/arsdigita/developersupport/Debug.java b/ccm-core/src/com/arsdigita/developersupport/Debug.java index 227655103..419da7187 100755 --- a/ccm-core/src/com/arsdigita/developersupport/Debug.java +++ b/ccm-core/src/com/arsdigita/developersupport/Debug.java @@ -157,9 +157,9 @@ public class Debug { String fieldName) throws SecurityException { - Assert.assertNotNull(klass, "klass"); - Assert.assertNotNull(obj, "obj"); - Assert.assertNotNull(fieldName, "fieldName"); + Assert.exists(klass, "klass"); + Assert.exists(obj, "obj"); + Assert.exists(fieldName, "fieldName"); try { Field field = klass.getDeclaredField(fieldName); diff --git a/ccm-core/src/com/arsdigita/developersupport/LoggingProxyFactory.java b/ccm-core/src/com/arsdigita/developersupport/LoggingProxyFactory.java index 35c54a209..0ad5b90d0 100755 --- a/ccm-core/src/com/arsdigita/developersupport/LoggingProxyFactory.java +++ b/ccm-core/src/com/arsdigita/developersupport/LoggingProxyFactory.java @@ -139,7 +139,7 @@ public final class LoggingProxyFactory implements LoggerConfigurator { boolean configurable) { Assert.exists(iface, Class.class); - Assert.truth(iface.isInstance(proxiedObject), + Assert.isTrue(iface.isInstance(proxiedObject), "proxiedObject is instance of iface"); Class[] ifaces = configurable ? diff --git a/ccm-core/src/com/arsdigita/developersupport/SQLDebugger.java b/ccm-core/src/com/arsdigita/developersupport/SQLDebugger.java index e3177a400..a1c5a434c 100755 --- a/ccm-core/src/com/arsdigita/developersupport/SQLDebugger.java +++ b/ccm-core/src/com/arsdigita/developersupport/SQLDebugger.java @@ -145,7 +145,7 @@ public final class SQLDebugger { **/ public static void startNewFile(String prefix) { Assert.exists(prefix, String.class); - Assert.truth(prefix.length() > 2, + Assert.isTrue(prefix.length() > 2, "'" + prefix + "' is at least 3 characters long."); if ( debugger().m_writer != null ) { @@ -167,7 +167,7 @@ public final class SQLDebugger { tmpDir = "/tmp"; } File result = new File(tmpDir); - Assert.truth(result.isDirectory(), tmpDir + " is a directory"); + Assert.isTrue(result.isDirectory(), tmpDir + " is a directory"); return result; } diff --git a/ccm-core/src/com/arsdigita/developersupport/StackTraces.java b/ccm-core/src/com/arsdigita/developersupport/StackTraces.java index 2d799d9eb..4226319c0 100755 --- a/ccm-core/src/com/arsdigita/developersupport/StackTraces.java +++ b/ccm-core/src/com/arsdigita/developersupport/StackTraces.java @@ -53,7 +53,7 @@ import org.apache.log4j.Logger; * ... * * public CancelListener(final FormSection form) { - * Assert.assertNotNull(form, "FormSection form"); + * Assert.exists(form, "FormSection form"); * * if (form instanceof Cancellable) { * m_cancellable = (Cancellable) form; diff --git a/ccm-core/src/com/arsdigita/dispatcher/DispatcherHelper.java b/ccm-core/src/com/arsdigita/dispatcher/DispatcherHelper.java index 27d11021d..c5983f008 100755 --- a/ccm-core/src/com/arsdigita/dispatcher/DispatcherHelper.java +++ b/ccm-core/src/com/arsdigita/dispatcher/DispatcherHelper.java @@ -44,12 +44,12 @@ import javax.servlet.jsp.PageContext; import org.apache.log4j.Logger; /** - * Class static helper methods for - * request dispatching. Contains various generally useful procedural - * abstractions. + * Class static helper methods for request dispatching. + * Contains various generally useful procedural abstractions. * * @author Bill Schneider * @version ACS 4.5 + * @version $Id: DispatcherHelper.java 311 2005-02-28 11:10:00Z mbooth $ * @since 4.5 */ public final class DispatcherHelper implements DispatcherConstants { private static final Logger s_log = Logger.getLogger @@ -89,11 +89,16 @@ public final class DispatcherHelper implements DispatcherConstants { */ private static ThreadLocal s_request = new ThreadLocal(); - public static final String versionId = "$Id: DispatcherHelper.java 311 2005-02-28 11:10:00Z mbooth $ by $Author: mbooth $, $DateTime: 2004/08/16 18:10:38 $"; - /** null constructor, private so no one can instantiate! */ private DispatcherHelper() { } + /** + * Return default cache expiry. + * Default is specified in the configuration file (registry) if not + * otherweise set. + * + * @return default cache expiry + */ public static int getDefaultCacheExpiry() { init(); return s_defaultExpiry; @@ -323,14 +328,13 @@ public final class DispatcherHelper implements DispatcherConstants { } /** - * Unsupported - * - * Given the name of a resource in the file system that is missing - * an extension, picks an extension that matches. Serves a file + * Given the name of a resource in the file system that is missing an + * extension, picks an extension that matches. Serves a file * with a .jsp extension first, if available. - * Otherwise picks any file - * that matches. For directories, it tacks on the "index" - * filename plus the extension. + * Otherwise picks any file that matches. For directories, it tacks on + * the "index" filename plus the extension. + * + * Unsupported * * @param abstractFile the extensionless file * @param actx the current application context @@ -430,11 +434,10 @@ public final class DispatcherHelper implements DispatcherConstants { } /** - * If the given servlet request is wrapped in one of our own - * classes, returns the original (unwrapped) request object and - * stores a reference to the request wrapper in the request - * attributes of the returned request. Otherwise just returns the - * request object. + * If the given servlet request is wrapped in one of our own classes, returns + * the original (unwrapped) request object and stores a reference + * to the request wrapper in the request attributes of the returned request. + * Otherwise just returns the request object. * * @param req the servlet request * @return the original servlet request object, as created by @@ -455,10 +458,11 @@ public final class DispatcherHelper implements DispatcherConstants { * If we've stored a reference to a request wrapper as a request * attribute to the current servlet request, returns the wrapper object. * Otherwise, returns the request object. + * * @param req the current servlet request * @return the previously created wrapper around the current servlet - * request, if any; - * otherwise returns the request object. + * request, if any; + * otherwise returns the request object. */ public static HttpServletRequest restoreRequestWrapper (HttpServletRequest req) { @@ -473,9 +477,8 @@ public final class DispatcherHelper implements DispatcherConstants { } /** - * This method will optionally wrap the request if it - * is a multipart POST, or restore the original wrapper - * if it was already wrapped + * This method will optionally wrap the request if it is a multipart POST, + * or restore the original wrapper if it was already wrapped. */ public static HttpServletRequest maybeWrapRequest(HttpServletRequest sreq) throws IOException, ServletException { @@ -585,7 +588,7 @@ public final class DispatcherHelper implements DispatcherConstants { // (i.e. index file in current directory) // works properly when running in Apache. // DEE 3/13/01 the original apache redirect-fix string of "?" - // has been replaced with ".", becuase + // has been replaced with ".", because // IE will reload the current page if redirected to "?". url = "."; } @@ -638,11 +641,10 @@ public final class DispatcherHelper implements DispatcherConstants { /** * Adds a ParameterProvider to the URLRewriter engine. - * ParameterProviders are used - * when encodeRedirectURL and encodeURL - * are called. They add global state parameters - * like the session ID (for cookieless login) to URLs for links and - * redirects. + * ParameterProviders are used when + * encodeRedirectURL and encodeURL are + * called. They add global state parameters like the session ID (for + * cookieless login) to URLs for links and redirects. * * @param provider the parameter provider to add * @see com.arsdigita.util.URLRewriter#addParameterProvider @@ -720,12 +722,12 @@ public final class DispatcherHelper implements DispatcherConstants { } /** - * Returns a global URL prefix for referencing static assets (images, - * CSS, etc.) on disk in href attributes. This can be on the same - * server ("/STATIC/") or a different server/port - * ("http://server:port/dir/"). The return value is guaranteed to - * end with a trailing slash. Usage example: + * Returns a global URL prefix for referencing static assets (images, CSS, + * etc.) on disk in href attributes. This can be on the same server + * ("/STATIC/") or a different server/port ("http://server:port/dir/"). + * The return value is guaranteed to end with a trailing slash. * + * Usage example: *
      * String pathToImage = DispatcherHelper.getStaticURL() + "images/pic.gif";
      * Image img = new Image(pathToImage);
@@ -739,8 +741,8 @@ public final class DispatcherHelper implements DispatcherConstants {
     }
 
     /**
-     * sets the  global URL prefix for referencing static assets
-     * (images, CSS, etc.) from user-agents in href attributes.
+     * sets the  global URL prefix for referencing static assets (images, CSS,
+     * etc.) from user-agents in href attributes.
      * Package visibility is intentional.
      *
      * @param s the static asset URL
@@ -763,8 +765,8 @@ public final class DispatcherHelper implements DispatcherConstants {
      * the value of s_webappContext will be set when there is a request.
      * Package visibility is intentional.
      *
-     * @param webappCtx the webappContext specified in enterprise.init.  Normally this would
-     * be "/".
+     * @param webappCtx the webappContext specified in enterprise.init. 
+     *        Normally this wouldbe "/".
      */
     static void setWebappContext(String webappCtx) {
         init();
@@ -803,10 +805,10 @@ public final class DispatcherHelper implements DispatcherConstants {
                 }
                 if ( !s_webappCtx.equals(webappCtx) ) {
                     s_log.warn(
-                               "webappContext changed. Expected='" + s_webappCtx +
-                               "' found='" + webappCtx + "'.\nPerhaps the enterprise.init " +
-                               "com.arsdigita.dispatcher.Initializer webappContext " +
-                               "parameter is wrong.");
+                          "webappContext changed. Expected='" + s_webappCtx +
+                          "' found='" + webappCtx + "'.\nPerhaps the enterprise.init " +
+                          "com.arsdigita.dispatcher.Initializer webappContext " +
+                          "parameter is wrong.");
                     // Save the webappCtx from the request for future use.
                     s_webappCtx = webappCtx;
                 }
@@ -880,7 +882,8 @@ public final class DispatcherHelper implements DispatcherConstants {
         if (!s_cachingActive)
             return;
 
-        // Assert.assertTrue(!response.containsHeader("Cache-Control"), "Caching headers have already been set");
+        // Assert.isTrue(!response.containsHeader("Cache-Control"),
+        //                   "Caching headers have already been set");
         // XXX Probably need to assert here if isCommitted() returns true.
         // But first need to figure out what is setting Cache-Control.
         if (response.containsHeader("Cache-Control"))
@@ -955,7 +958,8 @@ public final class DispatcherHelper implements DispatcherConstants {
         if (!s_cachingActive)
             return;
 
-        Assert.assertTrue(!response.containsHeader("Cache-Control"), "Caching headers have already been set");
+        Assert.isTrue(!response.containsHeader("Cache-Control"),
+                      "Caching headers have already been set");
 
         s_log.info("Setting cache control to user");
 
@@ -1039,8 +1043,8 @@ public final class DispatcherHelper implements DispatcherConstants {
         if (!s_cachingActive)
             return;
 
-        Assert.assertTrue(!response.containsHeader("Cache-Control"),
-                          "Caching headers have already been set");
+        Assert.isTrue(!response.containsHeader("Cache-Control"),
+                      "Caching headers have already been set");
 
         Calendar expires = Calendar.getInstance();
         expires.add( Calendar.SECOND, maxage );
diff --git a/ccm-core/src/com/arsdigita/domain/DomainObject.java b/ccm-core/src/com/arsdigita/domain/DomainObject.java
index 389fddce7..60b46300b 100755
--- a/ccm-core/src/com/arsdigita/domain/DomainObject.java
+++ b/ccm-core/src/com/arsdigita/domain/DomainObject.java
@@ -35,18 +35,16 @@ import org.apache.log4j.Logger;
 
 
 /**
- * This is the base class that all other persistent classes would
- * extend. It provides methods that delegate to a contained
- * DataObject.
+ * This is the base class that all other persistent classes would extend.
+ * It provides methods that delegate to a contained DataObject.
+ * @see com.arsdigita.persistence.DataObject
  *
  * @version 1.0
- *
- * @see com.arsdigita.persistence.DataObject
+ * @version $Id: DomainObject.java 738 2005-09-01 12:36:52Z sskracic $
  **/
 public abstract class DomainObject {
 
-    public static final String versionId = "$Id: DomainObject.java 738 2005-09-01 12:36:52Z sskracic $ by $Author: sskracic $, $DateTime: 2004/08/16 18:10:38 $";
-
+    /** The logging object for this class. */
     private static final Logger s_log =
         Logger.getLogger(DomainObject.class);
 
@@ -54,19 +52,19 @@ public abstract class DomainObject {
     private boolean m_initialized = false;
 
     /**
-     * Constructor. The contained DataObject is
-     * initialized with a new DataObject with an
-     * ObjectType specified by the string
-     * typeName.
-     *
-     * @param typeName The name of the ObjectType of the
-     * new instance.
+     * Constructor. The contained DataObject is initialized with
+     * a new DataObject with an ObjectType
+     * specified by the string typeName.
      *
      * @see com.arsdigita.persistence.Session#create(String)
      * @see com.arsdigita.persistence.DataObject
      * @see com.arsdigita.persistence.metadata.ObjectType
+     *
+     * @param typeName The name of the ObjectType of the
+     *        new instance.
      **/
     public DomainObject(String typeName) {
+
         Session s = SessionManager.getSession();
         if (s == null) {
             throw new RuntimeException("Could not retrieve a session from " +
@@ -80,15 +78,15 @@ public abstract class DomainObject {
     }
 
     /**
-     * Constructor. The contained DataObject is
-     * initialized with a new DataObject with an
-     * ObjectType specified by type.
-     *
-     * @param type The ObjectType of the new instance.
+     * The contained DataObject is initialized with a new
+     * DataObject with an ObjectType
+     * specified by type.
      *
      * @see com.arsdigita.persistence.Session#create(ObjectType)
      * @see com.arsdigita.persistence.DataObject
      * @see com.arsdigita.persistence.metadata.ObjectType
+     *
+     * @param type The ObjectType of the new instance.
      **/
     public DomainObject(ObjectType type) {
         Session s = SessionManager.getSession();
@@ -105,19 +103,18 @@ public abstract class DomainObject {
     }
 
     /**
-     * Constructor. The contained DataObject is retrieved
-     * from the persistent storage mechanism with an OID specified by
-     * oid.
+     * The contained DataObject is retrieved from the
+     * persistent storage mechanism with an OID specified by oid.
+     *
+     * @see com.arsdigita.persistence.Session#retrieve(OID)
+     * @see com.arsdigita.persistence.DataObject
+     * @see com.arsdigita.persistence.OID
      *
      * @param oid The OID for the retrieved
      * DataObject.
      *
      * @exception DataObjectNotFoundException Thrown if we cannot
-     * retrieve a data object for the specified OID
-     *
-     * @see com.arsdigita.persistence.Session#retrieve(OID)
-     * @see com.arsdigita.persistence.DataObject
-     * @see com.arsdigita.persistence.OID
+     *            retrieve a data object for the specified OID
      **/
     public DomainObject(OID oid) throws DataObjectNotFoundException {
         Session s = SessionManager.getSession();
@@ -138,12 +135,11 @@ public abstract class DomainObject {
     }
 
     /**
-     * Constructor. Creates a new DomainObject instance to encapsulate a given
-     * data object.
+     * Creates a new DomainObject instance to encapsulate a given data object.
+     * @see com.arsdigita.persistence.Session#retrieve(String)
      *
      * @param dataObject The data object to encapsulate in the new domain
      * object.
-     * @see com.arsdigita.persistence.Session#retrieve(String)
      **/
     public DomainObject(DataObject dataObject) {
         m_dataObject = dataObject;
@@ -157,9 +153,9 @@ public abstract class DomainObject {
      * only work if their primary data object is of a certain base type.
      *
      * @return The fully qualified name ("modelName.typeName") of the base
-     * data object type for this domain object class,
-     * or null if there is no restriction on the data object type for
-     * the primary data object encapsulated by this class.
+     * data object type for this domain object class, or null if there is
+     * no restriction on the data object type for the primary data object
+     * encapsulated by this class.
      **/
     protected String getBaseDataObjectType() {
         return null;
@@ -190,6 +186,9 @@ public abstract class DomainObject {
         ObjectType.verifySubtype(baseTypeName, m_dataObject.getObjectType());
     }
 
+    /**
+     * 
+     */
     private void postInitialization() {
         if (!m_initialized) {
             StringWriter sw = new StringWriter();
@@ -296,18 +295,17 @@ public abstract class DomainObject {
     }
 
     /**
-     * Persists any changes made to this object. Note that a data
-     * object can be saved without a call to its corresponding domain
-     * object's save() method. This means that save() is not
-     * guaranteed to be called when saves are cascaded due to
-     * associations. For instance, suppose a Folder contains numerous
-     * File objects. Adding Files to that Folder and calling
-     * Folder.save() will implicitly save all the files without
-     * calling the File's DomainObject.save() method.
+     * Persists any changes made to this object. Note that a data object can
+     * be saved without a call to its corresponding domain object's save()
+     * method. This means that save() is not guaranteed to be called when
+     * saves are cascaded due to associations. For instance, suppose a Folder
+     * contains numerous File objects. Adding Files to that Folder and calling
+     * Folder.save() will implicitly save all the files without calling the
+     * File's DomainObject.save() method.
      *
-     * Do not override the save() method under any circumstances. Use
-     * beforeSave and afterSave instead. This method is not declared
-     * final for backwards compatibility.
+     * Do not override the save() method under any circumstances. Use
+     * beforeSave and afterSave instead. This method is not declared final for
+     * backwards compatibility.
      *
      * @see com.arsdigita.persistence.DataObject#save()
      * @see #beforeSave()
diff --git a/ccm-core/src/com/arsdigita/domain/DomainObjectTraversal.java b/ccm-core/src/com/arsdigita/domain/DomainObjectTraversal.java
index f8a4e868e..d6bee578d 100755
--- a/ccm-core/src/com/arsdigita/domain/DomainObjectTraversal.java
+++ b/ccm-core/src/com/arsdigita/domain/DomainObjectTraversal.java
@@ -487,7 +487,7 @@ public abstract class DomainObjectTraversal {
 
     protected String nameFromPath(String path) {
         int index = path.lastIndexOf("/");
-        Assert.truth(index >= 0, "Path starts with /");
+        Assert.isTrue(index >= 0, "Path starts with /");
 
         if (path.endsWith("+")) {
             return path.substring(index + 1, path.length() - 1);
@@ -498,7 +498,7 @@ public abstract class DomainObjectTraversal {
 
     protected String parentFromPath(String path) {
         int index = path.lastIndexOf("/");
-        Assert.truth(index >= 0, "Path starts with /");
+        Assert.isTrue(index >= 0, "Path starts with /");
 
         if (index == 0) {
             return null;
diff --git a/ccm-core/src/com/arsdigita/formbuilder/MetaObjectCollection.java b/ccm-core/src/com/arsdigita/formbuilder/MetaObjectCollection.java
index ba38ba0d1..4c430e7de 100755
--- a/ccm-core/src/com/arsdigita/formbuilder/MetaObjectCollection.java
+++ b/ccm-core/src/com/arsdigita/formbuilder/MetaObjectCollection.java
@@ -41,7 +41,7 @@ public class MetaObjectCollection extends DomainCollection {
     public BigDecimal getID() {
         BigDecimal id = (BigDecimal)m_dataCollection.get("id");
 
-        Assert.assertNotNull(id);
+        Assert.exists(id);
 
         return id;
     }
@@ -55,7 +55,7 @@ public class MetaObjectCollection extends DomainCollection {
     public DomainObject getDomainObject() {
         DomainObject domainObject = getMetaObject();
 
-        Assert.assertNotNull(domainObject);
+        Assert.exists(domainObject);
 
         return domainObject;
     }
@@ -71,7 +71,7 @@ public class MetaObjectCollection extends DomainCollection {
 
         MetaObject obj = MetaObject.retrieve(dataObject);
 
-        Assert.assertNotNull(obj);
+        Assert.exists(obj);
 
         return obj;
     }
diff --git a/ccm-core/src/com/arsdigita/formbuilder/PersistentComponent.java b/ccm-core/src/com/arsdigita/formbuilder/PersistentComponent.java
index 9d5dc7069..4ba91ac3e 100755
--- a/ccm-core/src/com/arsdigita/formbuilder/PersistentComponent.java
+++ b/ccm-core/src/com/arsdigita/formbuilder/PersistentComponent.java
@@ -130,7 +130,7 @@ public abstract class PersistentComponent extends AuditedACSObject {
      */
     protected void beforeSave() {
         if (m_attributeChanged) {
-            Assert.assertNotNull(m_attributes, "Attribute map");
+            Assert.exists(m_attributes, "Attribute map");
             set(ATTRIBUTE_STRING,
                 AttributeHelper.getAttributeString(m_attributes));
             m_attributeChanged = false;
diff --git a/ccm-core/src/com/arsdigita/formbuilder/PersistentOptionGroup.java b/ccm-core/src/com/arsdigita/formbuilder/PersistentOptionGroup.java
index 27a1dce5e..3b31a2436 100755
--- a/ccm-core/src/com/arsdigita/formbuilder/PersistentOptionGroup.java
+++ b/ccm-core/src/com/arsdigita/formbuilder/PersistentOptionGroup.java
@@ -165,7 +165,7 @@ public abstract class PersistentOptionGroup extends PersistentWidget {
         if (!isMultiple()) {
             // only one option may be selected
             // to this selected list better be empty
-            Assert.assertTrue(getSelectedOptions().size() == 0, TOO_MANY_OPTIONS_SELECTED);
+            Assert.isTrue(getSelectedOptions().size() == 0, TOO_MANY_OPTIONS_SELECTED);
         }
 
         m_container.setComponentSelected(option, selected);
diff --git a/ccm-core/src/com/arsdigita/formbuilder/parameters/PersistentParameterListener.java b/ccm-core/src/com/arsdigita/formbuilder/parameters/PersistentParameterListener.java
index 8916d8909..775ae0ae6 100755
--- a/ccm-core/src/com/arsdigita/formbuilder/parameters/PersistentParameterListener.java
+++ b/ccm-core/src/com/arsdigita/formbuilder/parameters/PersistentParameterListener.java
@@ -120,7 +120,7 @@ public class PersistentParameterListener extends ACSObject {
 
     protected void beforeSave() {
         if (m_attributeChanged) {
-            Assert.assertNotNull(m_attributes, "Attribute map");
+            Assert.exists(m_attributes, "Attribute map");
             set("attributeString",
                 AttributeHelper.getAttributeString(m_attributes));
             m_attributeChanged = false;
diff --git a/ccm-core/src/com/arsdigita/formbuilder/ui/editors/WidgetForm.java b/ccm-core/src/com/arsdigita/formbuilder/ui/editors/WidgetForm.java
index 841c3dbff..b07dccd78 100755
--- a/ccm-core/src/com/arsdigita/formbuilder/ui/editors/WidgetForm.java
+++ b/ccm-core/src/com/arsdigita/formbuilder/ui/editors/WidgetForm.java
@@ -186,7 +186,7 @@ public abstract class WidgetForm extends PropertiesForm {
      *  This can only be called after calling addWidgets()
      */
     protected void automaticallySetName(ParameterModel model) {
-        Assert.assertNotNull(m_name);
+        Assert.exists(m_name);
         m_name.setOnFocus("defaulting = false");
         m_name.setOnBlur(
             "if (this.value == '') " +
diff --git a/ccm-core/src/com/arsdigita/formbuilder/util/AttributeHelper.java b/ccm-core/src/com/arsdigita/formbuilder/util/AttributeHelper.java
index 6401bebf2..c87d069a1 100755
--- a/ccm-core/src/com/arsdigita/formbuilder/util/AttributeHelper.java
+++ b/ccm-core/src/com/arsdigita/formbuilder/util/AttributeHelper.java
@@ -117,7 +117,7 @@ public class AttributeHelper {
             String attributeName = (String)attributeNameIterator.next();
             String attributeValue = (String)attributeMap.get(attributeName);
             
-            Assert.assertTrue(perl.match("/^\\w+$/",
+            Assert.isTrue(perl.match("/^\\w+$/",
                                          attributeName));            
             attributeValue = StringUtils.quoteHtml(attributeValue);
 
diff --git a/ccm-core/src/com/arsdigita/globalization/Globalization.java b/ccm-core/src/com/arsdigita/globalization/Globalization.java
index 9d5748d35..5136dd15b 100755
--- a/ccm-core/src/com/arsdigita/globalization/Globalization.java
+++ b/ccm-core/src/com/arsdigita/globalization/Globalization.java
@@ -106,7 +106,7 @@ public class Globalization {
                 Locale localeObject = new Locale(locales.getDataObject());
                 java.util.Locale locale = localeObject.toJavaLocale();
                 Charset defaultCharset = localeObject.getDefaultCharset();
-                Assert.assertNotNull(defaultCharset,
+                Assert.exists(defaultCharset,
                                      "DefaultCharset for locale \""
                                      + locale + "\" (" + localeObject + ")");
                 String charset = defaultCharset.getCharset();
diff --git a/ccm-core/src/com/arsdigita/kernel/ACSObjectCache.java b/ccm-core/src/com/arsdigita/kernel/ACSObjectCache.java
index b8348a220..a55c1888e 100755
--- a/ccm-core/src/com/arsdigita/kernel/ACSObjectCache.java
+++ b/ccm-core/src/com/arsdigita/kernel/ACSObjectCache.java
@@ -73,9 +73,9 @@ public class ACSObjectCache {
      * @post obj.equals(getRequestCache(req, obj.getID()))
      */
     public static void set(ServletRequest req, ACSObject obj) {
-        Assert.assertNotNull(req);
-        Assert.assertNotNull(obj);
-        Assert.assertNotNull(obj.getID());
+        Assert.exists(req);
+        Assert.exists(obj);
+        Assert.exists(obj.getID());
         req.setAttribute(attributeName(obj.getID()), obj);
     }
 
diff --git a/ccm-core/src/com/arsdigita/kernel/PackageType.java b/ccm-core/src/com/arsdigita/kernel/PackageType.java
index 1d97e1617..ba7d559c7 100755
--- a/ccm-core/src/com/arsdigita/kernel/PackageType.java
+++ b/ccm-core/src/com/arsdigita/kernel/PackageType.java
@@ -18,7 +18,6 @@
  */
 package com.arsdigita.kernel;
 
-// For Id.
 import com.arsdigita.db.Sequences;
 import com.arsdigita.dispatcher.Dispatcher;
 import com.arsdigita.domain.DataObjectNotFoundException;
@@ -30,6 +29,7 @@ import com.arsdigita.persistence.OID;
 import com.arsdigita.persistence.PersistenceException;
 import com.arsdigita.persistence.SessionManager;
 import com.arsdigita.util.UncheckedWrapperException;
+
 import java.lang.reflect.Constructor;
 import java.lang.reflect.InvocationTargetException;
 import java.math.BigDecimal;
@@ -37,18 +37,21 @@ import java.sql.SQLException;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Locale;
+
 import org.apache.log4j.Logger;
 
 /**
  * Represents a package type.
  *
+ * @since ACS 5.0
  * @deprecated Use {@link com.arsdigita.web.ApplicationType} instead.
  * @version $Revision: #15 $, $Date: 2004/08/16 $
- * @since ACS 5.0
+ * @version $Id: PackageType.java 287 2005-02-22 00:29:02Z sskracic $
  */
 
 public class PackageType extends com.arsdigita.domain.DomainObject {
-    public static final String versionId = "$Id: PackageType.java 287 2005-02-22 00:29:02Z sskracic $ by $Author: sskracic $, $DateTime: 2004/08/16 18:10:38 $";
+
+    /** The logging object for this class. */
     private static final Logger s_log =
         Logger.getLogger(PackageType.class.getName());
 
diff --git a/ccm-core/src/com/arsdigita/kernel/ResourceCollection.java b/ccm-core/src/com/arsdigita/kernel/ResourceCollection.java
index 5f1a52657..355637132 100755
--- a/ccm-core/src/com/arsdigita/kernel/ResourceCollection.java
+++ b/ccm-core/src/com/arsdigita/kernel/ResourceCollection.java
@@ -77,7 +77,7 @@ public class ResourceCollection extends ACSObjectCollection {
         Resource resource =
             Resource.retrieveResource(dataObject);
 
-        Assert.assertNotNull(resource, "resource");
+        Assert.exists(resource, "resource");
 
         return resource;
     }
@@ -91,7 +91,7 @@ public class ResourceCollection extends ACSObjectCollection {
     public String getTitle() {
         String title = (String)m_dataCollection.get("title");
 
-        Assert.assertNotNull(title, "title");
+        Assert.exists(title, "title");
 
         return title;
     }
diff --git a/ccm-core/src/com/arsdigita/kernel/ResourceType.java b/ccm-core/src/com/arsdigita/kernel/ResourceType.java
index c808b9bdb..08aa65ca7 100755
--- a/ccm-core/src/com/arsdigita/kernel/ResourceType.java
+++ b/ccm-core/src/com/arsdigita/kernel/ResourceType.java
@@ -51,13 +51,14 @@ import org.apache.log4j.Logger;
  * @version $Id: ResourceType.java 287 2005-02-22 00:29:02Z sskracic $
  */
 public class ResourceType extends DomainObject {
-    public static final String versionId =
-        "$Id: ResourceType.java 287 2005-02-22 00:29:02Z sskracic $" +
-        "$Author: sskracic $" +
-        "$DateTime: 2004/08/16 18:10:38 $";
 
+    /** The logging object for this class. */
     private static final Logger s_log = Logger.getLogger(ResourceType.class);
 
+    // ===== Constants ======================================================= //
+
+    /** The fully qualified model name of the underlying data object, which in
+     *  this case is the same as the Java type. */
     public static final String BASE_DATA_OBJECT_TYPE =
         "com.arsdigita.kernel.ResourceType";
 
@@ -68,6 +69,13 @@ public class ResourceType extends DomainObject {
     protected static ResourceTypeConfig s_defaultConfig =
         new ResourceTypeConfig();
 
+    // ===== Constructors ==================================================== //
+
+    /**
+     * Creates a new ResourceObject instance to encapsulate a given data object.
+     * 
+     * @param dataObject
+     */
     protected ResourceType(DataObject dataObject) {
         super(dataObject);
     }
@@ -78,33 +86,32 @@ public class ResourceType extends DomainObject {
         setID(generateID());
     }
 
-    protected ResourceType
-        (String dataObjectType, String title,
-         String resourceObjectType) {
+    protected ResourceType(String dataObjectType,
+                           String title,
+                           String resourceObjectType) {
         this(dataObjectType);
 
-        Assert.assertNotNull(title, "title");
-        Assert.assertNotNull(resourceObjectType, "resourceObjectType");
-
+        Assert.exists(title, "title");
+        Assert.exists(resourceObjectType, "resourceObjectType");
 
         setTitle(title);
         setResourceObjectType(resourceObjectType);
 
     }
 
+    // ===== Class Methods =================================================== //
+
     public static ResourceType createResourceType
         (String title, String resourceObjectType) {
         return new ResourceType
             (BASE_DATA_OBJECT_TYPE, title, resourceObjectType);
     }
 
-
-
     // No null params.
 
     // Param
     public static ResourceType retrieveResourceType(BigDecimal id) {
-        Assert.assertNotNull(id, "id");
+        Assert.exists(id, "id");
 
         return ResourceType.retrieveResourceType
             (new OID(ResourceType.BASE_DATA_OBJECT_TYPE, id));
@@ -112,11 +119,11 @@ public class ResourceType extends DomainObject {
 
     // Param oid cannot be null.
     public static ResourceType retrieveResourceType(OID oid) {
-        Assert.assertNotNull(oid, "oid");
+        Assert.exists(oid, "oid");
 
         DataObject dataObject = SessionManager.getSession().retrieve(oid);
 
-        Assert.assertNotNull(dataObject);
+        Assert.exists(dataObject);
 
         return ResourceType.retrieveResourceType(dataObject);
     }
@@ -124,7 +131,7 @@ public class ResourceType extends DomainObject {
     // Param dataObject cannot be null.  Can return null?
     public static ResourceType retrieveResourceType
         (DataObject dataObject) {
-        Assert.assertNotNull(dataObject, "dataObject");
+        Assert.exists(dataObject, "dataObject");
 
         return new ResourceType(dataObject);
     }
@@ -132,7 +139,7 @@ public class ResourceType extends DomainObject {
     // Can return null.
     public static ResourceType retrieveResourceTypeForResource
         (String resourceObjectType) {
-        Assert.assertNotNull(resourceObjectType, "resourceObjectType");
+        Assert.exists(resourceObjectType, "resourceObjectType");
 
         DataCollection collection =
             SessionManager.getSession().retrieve(BASE_DATA_OBJECT_TYPE);
@@ -155,7 +162,7 @@ public class ResourceType extends DomainObject {
         DataCollection collection =
             SessionManager.getSession().retrieve(BASE_DATA_OBJECT_TYPE);
 
-        Assert.assertNotNull(collection, "collection");
+        Assert.exists(collection, "collection");
 
         return new ResourceTypeCollection(collection);
     }
@@ -172,13 +179,13 @@ public class ResourceType extends DomainObject {
     public String getTitle() {
         String title = (String) get("title");
 
-        Assert.assertNotNull(title, "title");
+        Assert.exists(title, "title");
 
         return title;
     }
 
     public void setTitle(String title) {
-        Assert.assertNotNull(title, "title");
+        Assert.exists(title, "title");
 
         set("title", title);
     }
@@ -258,13 +265,13 @@ public class ResourceType extends DomainObject {
     public String getResourceObjectType() {
         String objectType = (String)get("objectType");
 
-        Assert.assertNotNull(objectType);
+        Assert.exists(objectType);
 
         return objectType;
     }
 
     protected void setResourceObjectType(String objectType) {
-        Assert.assertNotNull(objectType);
+        Assert.exists(objectType);
 
         set("objectType", objectType);
     }
@@ -277,7 +284,7 @@ public class ResourceType extends DomainObject {
     public BigDecimal getID() {
         BigDecimal id = (BigDecimal)get("id");
 
-        Assert.assertNotNull(id, "id");
+        Assert.exists(id, "id");
 
         return id;
     }
@@ -290,7 +297,7 @@ public class ResourceType extends DomainObject {
      * @return the value that the ID property is set to.
      */
     private BigDecimal setID(BigDecimal id) {
-        Assert.assertNotNull(id, "id");
+        Assert.exists(id, "id");
 
         if (isNew() && get("id") == null) {
             set("id", id);
diff --git a/ccm-core/src/com/arsdigita/kernel/ResourceTypeCollection.java b/ccm-core/src/com/arsdigita/kernel/ResourceTypeCollection.java
index c0d25ec3e..756ebb400 100755
--- a/ccm-core/src/com/arsdigita/kernel/ResourceTypeCollection.java
+++ b/ccm-core/src/com/arsdigita/kernel/ResourceTypeCollection.java
@@ -57,7 +57,7 @@ public class ResourceTypeCollection extends DomainCollection {
     public ResourceType getResourceType() {
         DataObject dataObject = m_dataCollection.getDataObject();
 
-        Assert.assertNotNull(dataObject, "dataObject");
+        Assert.exists(dataObject, "dataObject");
 
         ResourceType resourceType =
             ResourceType.retrieveResourceType(dataObject);
diff --git a/ccm-core/src/com/arsdigita/kernel/ResourceTypeConfig.java b/ccm-core/src/com/arsdigita/kernel/ResourceTypeConfig.java
index 831f7efd3..21fab1126 100755
--- a/ccm-core/src/com/arsdigita/kernel/ResourceTypeConfig.java
+++ b/ccm-core/src/com/arsdigita/kernel/ResourceTypeConfig.java
@@ -18,13 +18,13 @@
  */
 package com.arsdigita.kernel;
 
-import com.arsdigita.kernel.permissions.PermissionDescriptor;
-import com.arsdigita.kernel.permissions.PermissionService;
-import com.arsdigita.kernel.permissions.PrivilegeDescriptor;
+import com.arsdigita.kernel.permissions.PermissionDescriptor;
+import com.arsdigita.kernel.permissions.PermissionService;
+import com.arsdigita.kernel.permissions.PrivilegeDescriptor;
 import com.arsdigita.kernel.ui.ResourceConfigFormSection;
 import com.arsdigita.kernel.ui.BasicResourceConfigFormSection;
 import com.arsdigita.kernel.ui.ResourceConfigComponent;
-import com.arsdigita.toolbox.ui.SecurityContainer;
+import com.arsdigita.toolbox.ui.SecurityContainer;
 import com.arsdigita.bebop.RequestLocal;
 import com.arsdigita.bebop.PageState;
 import com.arsdigita.bebop.Form;
@@ -42,70 +42,80 @@ import org.apache.log4j.Logger;
  * @see ResourceConfigFormSection
  * @see com.arsdigita.kernel.Resource
  * @author Justin Ross
- * @version $Id: ResourceTypeConfig.java 1270 2006-07-18 13:34:55Z cgyg9330 $
+ * @version $Id: ResourceTypeConfig.java 1270 2006-07-18 13:34:55Z cgyg9330 $
  */
 public class ResourceTypeConfig {
-    public static final String versionId =
-        "$Id: ResourceTypeConfig.java 1270 2006-07-18 13:34:55Z cgyg9330 $" +
-        "$Author: cgyg9330 $" +
-        "$DateTime: 2004/08/16 18:10:38 $";
 
+    /** The logging object for this class. */
     private static final Logger s_log = Logger.getLogger
         (ResourceTypeConfig.class);
 
     /**
-	 * optionally set - prevents create/modify form being rendered unless user has 
-	 * this privilege on the appropriate object (parent application in the case of create,
-	 * application in the case of modify
-	 */
-	private PrivilegeDescriptor m_createModifyPrivilege = null;
-	/**
-	 * optionally set - allows components that list applications to filter on the basis
-	 * of this privilege - see com.arsdigita.london.portal.ui.PersistantPortal
-	 * and com.arsdigita.london.portal.ui.ApplicationSelector
-	 */
-	private PrivilegeDescriptor m_viewPrivilege = null;
-	
-    /**
-     * For use in generating default config components when
-     * Resource authors don't specify their own.  Should only be
-     * used by PortletType.
+     * optionally set - prevents create/modify form being rendered unless user
+     * has this privilege on the appropriate object (parent application in the
+     * case of create, application in the case of modify
+     */
+    private PrivilegeDescriptor m_createModifyPrivilege = null;
+    /**
+     * optionally set - allows components that list applications to filter on the
+     * basis of this privilege - see com.arsdigita.london.portal.ui.PersistantPortal
+     * and com.arsdigita.london.portal.ui.ApplicationSelector
+     */
+    private PrivilegeDescriptor m_viewPrivilege = null;
+	
+    /**
+     * For use in generating default config components when Resource authors
+     * don't specify their own. 
+     * Should only be used by PortletType!
      */
     protected ResourceTypeConfig() {
         // Empty
     }
 
+    /**
+     * 
+     * @param resourceObjectType
+     */
     public ResourceTypeConfig(String resourceObjectType) {
-		this(resourceObjectType, null, null);
-	}
-
-	/**
-	 * constructor that allows the resource create and modify forms to be conditionally 
-	 * displayed according to the accessPrivilege. 
-	 * 
-	 * On creation, a permission check is carried out on the parent resource while
-	 * on modification, a permission check is carried out on the resource being modified.
-	 * 
-	 *  
-	 * @param resourceObjectType
-	 * @param accessPrivilege
-	 */
-    public ResourceTypeConfig(String resourceObjectType, PrivilegeDescriptor createModifyPrivilege, PrivilegeDescriptor viewPrivilege) {
+        this(resourceObjectType, null, null);
+    }
+
+    /**
+     * constructor that allows the resource create and modify forms to be
+     * conditionally displayed according to the accessPrivilege.
+     *
+     * On creation, a permission check is carried out on the parent resource while
+     * on modification, a permission check is carried out on the resource being modified.
+     *
+     *
+     * @param resourceObjectType
+     * @param accessPrivilege
+     */
+    public ResourceTypeConfig(String resourceObjectType, 
+                              PrivilegeDescriptor createModifyPrivilege,
+                              PrivilegeDescriptor viewPrivilege) {
         if (s_log.isDebugEnabled()) {
             s_log.debug("Registering " + this + " to object type " +
                         resourceObjectType);
         }
-        m_createModifyPrivilege = createModifyPrivilege;
-        m_viewPrivilege = viewPrivilege;
-        
-        s_log.debug("create/modify privilege is " + m_createModifyPrivilege + ". View privilege is " + m_viewPrivilege);
-        
-        
+        m_createModifyPrivilege = createModifyPrivilege;
+        m_viewPrivilege = viewPrivilege;
+        
+        s_log.debug("create/modify privilege is " + m_createModifyPrivilege +
+                    ". View privilege is " + m_viewPrivilege);
+        
+        
 
         ResourceType.registerResourceTypeConfig
             (resourceObjectType, this);
     }
 
+    /**
+     * 
+     * @param resType
+     * @param parentResRL
+     * @return
+     */
     public ResourceConfigFormSection getCreateFormSection
             (final ResourceType resType, final RequestLocal parentResRL) {
         final BasicResourceConfigFormSection config =
@@ -118,6 +128,11 @@ public class ResourceTypeConfig {
         return config;
     }
 
+    /**
+     * 
+     * @param application
+     * @return
+     */
     public ResourceConfigFormSection getModifyFormSection
             (final RequestLocal application) {
         final BasicResourceConfigFormSection config =
@@ -127,9 +142,9 @@ public class ResourceTypeConfig {
     }
 
     /**
-     * Retrieves the component for creating an instance of a
-     * ResourceType. The component should fire a completion
-     * event when it has finished processing.
+     * Retrieves the component for creating an instance of a ResourceType.
+     * The component should fire a completion event when it has finished
+     * processing.
      * @see com.arsdigita.bebop.Completable#fireCompletionEvent(PageState)
      */
     public ResourceConfigComponent getCreateComponent
@@ -137,13 +152,13 @@ public class ResourceTypeConfig {
         final ResourceConfigFormSection section =
             getCreateFormSection(resType, parentResRL);
 
-        return new ResourceConfigWrapperComponent(section, parentResRL);
+        return new ResourceConfigWrapperComponent(section, parentResRL);
     }
 
     /**
-     * Retrieves the component for modifying an instance of a
-     * ResourceType. The component should fire a completion
-     * event when it has finished processing.
+     * Retrieves the component for modifying an instance of a ResourceType.
+     * The component should fire a completion event when it has finished
+     * processing.
      * @see com.arsdigita.bebop.Completable#fireCompletionEvent(PageState)
      */
     public ResourceConfigComponent getModifyComponent
@@ -151,54 +166,68 @@ public class ResourceTypeConfig {
         final ResourceConfigFormSection section =
             getModifyFormSection(resource);
 
-        return new ResourceConfigWrapperComponent(section, resource);
+        return new ResourceConfigWrapperComponent(section, resource);
     }
 
+    /**
+     * 
+     * @param resource
+     */
     public void configureResource(Resource resource) {
         // Empty
     }
 
-    /**
-     * Retrieve privilege required for user to see an instance of the resource type. 
-     * Privilege may be specified in constructor, or this method may be overridden.
-     * 
-     * Privilege must be specified by overriding this method if the privilege is retrieved with 
-     * PrivilegeDescriptor.get, which relies on a map populated during legacy init event
-     * and so may not be populated when the ResourceTypeConfig is created.
-     * 
-     * If no privilege specified, null is returned
-     * @return
-     */
-    public PrivilegeDescriptor getViewPrivilege() {
-    	return m_viewPrivilege;
-    }
-	/**
-		 * Retrieve privilege required for user to create or modify an instance of the resource type. 
-		 * Privilege may be specified in constructor, or this method may be overridden.
-		 * 
-		 * Privilege must be specified by overriding this method if the privilege is retrieved with 
-		 * PrivilegeDescriptor.get, which relies on a map populated during legacy init event
-		 * and so may not be populated when the ResourceTypeConfig is created
-		 * 
-		 * If privilege is specified, view/modify form may not be displayed if user has insufficient 
-		 * privileges.
-		 * @return
-		 */
-	public PrivilegeDescriptor getCreateModifyPrivilege() {
-			return m_createModifyPrivilege;
-		}
-    
-
+    /**
+     * Retrieve privilege required for user to see an instance of the resource type. 
+     * Privilege may be specified in constructor, or this method may be overridden.
+     * 
+     * Privilege must be specified by overriding this method if the privilege is
+     * retrieved with  PrivilegeDescriptor.get, which relies on a map populated
+     * during legacy init event and so may not be populated when the
+     * ResourceTypeConfig is created.
+     * 
+     * If no privilege specified, null is returned
+     * @return
+     */
+    public PrivilegeDescriptor getViewPrivilege() {
+    	return m_viewPrivilege;
+    }
+
+    /**
+     * Retrieve privilege required for user to create or modify an instance of
+     * the resource type.
+     * Privilege may be specified in constructor, or this method may be overridden.
+     *
+     * Privilege must be specified by overriding this method if the privilege is
+     * retrieved with PrivilegeDescriptor.get, which relies on a map populated
+     * during legacy init event and so may not be populated when the
+     * ResourceTypeConfig is created.
+     *
+     * If privilege is specified, view/modify form may not be displayed if user
+     * has insufficient privileges.
+     *
+     * @return
+     */
+    public PrivilegeDescriptor getCreateModifyPrivilege() {
+        return m_createModifyPrivilege;
+    }
+    
+
+    /**
+     * 
+     */
     private class ResourceConfigWrapperComponent
             extends ResourceConfigComponent {
-        // on creation, check privilege against parent resource. On modification, check privilege against resource
-        private RequestLocal m_accessCheckRes;
+
+        // on creation, check privilege against parent resource. On modification,
+        // check privilege against resource
+        private RequestLocal m_accessCheckRes;
         private ResourceConfigFormSection m_section;
         private SaveCancelSection m_buttons;
 
         public ResourceConfigWrapperComponent
-                (ResourceConfigFormSection section, RequestLocal accessCheckResRL) {
-            m_accessCheckRes = accessCheckResRL;
+                (ResourceConfigFormSection section, RequestLocal accessCheckResRL) {
+            m_accessCheckRes = accessCheckResRL;
             m_section = section;
             m_buttons = new SaveCancelSection();
 
@@ -225,28 +254,36 @@ public class ResourceTypeConfig {
                         fireCompletionEvent(state);
                     }
                 });
-			if (m_createModifyPrivilege != null && m_accessCheckRes != null) {
-				s_log.debug("creating resource create/modify wrapper form with access check");
-				SecurityContainer sc = new SecurityContainer(form) {
-
-					protected boolean canAccess(Party party, PageState state) {
-						Resource resource = (Resource)m_accessCheckRes.get(state);
-						s_log.debug("check permission on " + resource + " for " + party.getPrimaryEmail().getEmailAddress());
-						PermissionDescriptor access = new PermissionDescriptor(m_createModifyPrivilege, resource, party);
-						return PermissionService.checkPermission(access);
-					}};
-            	add(sc);
-			} else {
-				s_log.debug("creating resource create/modify wrapper form without access check");
+            if (m_createModifyPrivilege != null && m_accessCheckRes != null) {
+                    s_log.debug("" +
+                        "creating resource create/modify wrapper form with access check");
+                    SecurityContainer sc = new SecurityContainer(form) {
+                        protected boolean canAccess(Party party, PageState state) {
+                            Resource resource = (Resource)m_accessCheckRes.get(state);
+                            s_log.debug("check permission on " + resource +
+                                        " for " + party.getPrimaryEmail().getEmailAddress());
+                            PermissionDescriptor access =
+                                new PermissionDescriptor(m_createModifyPrivilege,
+                                                         resource, party);
+                            return PermissionService.checkPermission(access);
+                            }};
+                    add(sc);
+            } else {
+                s_log.debug(
+                    "creating resource create/modify wrapper form without access check");
 
-            add(form);
+                add(form);
+            }
         }
-        }
 
+        /**
+         * 
+         * @param state
+         * @return
+         */
         public Resource createResource(PageState state) {
             Resource resource = null;
 
-
             // when either save is selected, or nothing is selected
             // (e.g. when pressing enter in IE)        
             if (m_buttons.getSaveButton().isSelected(state)
@@ -264,6 +301,6 @@ public class ResourceTypeConfig {
                 m_section.modifyResource(state);
             }
         }
-        
+        
     }
 }
diff --git a/ccm-core/src/com/arsdigita/kernel/UserFactory.java b/ccm-core/src/com/arsdigita/kernel/UserFactory.java
index d56a06cac..35ce0fab5 100755
--- a/ccm-core/src/com/arsdigita/kernel/UserFactory.java
+++ b/ccm-core/src/com/arsdigita/kernel/UserFactory.java
@@ -51,12 +51,12 @@ public final class UserFactory {
                                String uri,
                                EmailAddress additionalEmail) {
 
-        Assert.assertNotNull(primaryEmail, "primaryEmail");
-        Assert.assertNotNull(givenName, "givenName");
-        Assert.assertNotNull(familyName, "familyName");
-        Assert.assertNotNull(password, "password");
-        Assert.assertNotNull(passwordQuestion, "passwordQuestion");
-        Assert.assertNotNull(passwordAnswer, "passwordAnswer");
+        Assert.exists(primaryEmail, "primaryEmail");
+        Assert.exists(givenName, "givenName");
+        Assert.exists(familyName, "familyName");
+        Assert.exists(password, "password");
+        Assert.exists(passwordQuestion, "passwordQuestion");
+        Assert.exists(passwordAnswer, "passwordAnswer");
 
         User user = new User();
         user.setPrimaryEmail(primaryEmail);
diff --git a/ccm-core/src/com/arsdigita/kernel/permissions/PermissionCache.java b/ccm-core/src/com/arsdigita/kernel/permissions/PermissionCache.java
index eba33c456..3eafdd0b8 100755
--- a/ccm-core/src/com/arsdigita/kernel/permissions/PermissionCache.java
+++ b/ccm-core/src/com/arsdigita/kernel/permissions/PermissionCache.java
@@ -247,7 +247,7 @@ public final class PermissionCache {
             TransactionContext txn =
                 SessionManager.getSession().getTransactionContext();
             Assert.exists(txn, txn.getClass());
-            Assert.truth(txn.inTxn(), "Not in a transaction");
+            Assert.isTrue(txn.inTxn(), "Not in a transaction");
             return txn;
         }
     }
diff --git a/ccm-core/src/com/arsdigita/kernel/permissions/PermissionDescriptor.java b/ccm-core/src/com/arsdigita/kernel/permissions/PermissionDescriptor.java
index aeae03a49..f7abaedbf 100755
--- a/ccm-core/src/com/arsdigita/kernel/permissions/PermissionDescriptor.java
+++ b/ccm-core/src/com/arsdigita/kernel/permissions/PermissionDescriptor.java
@@ -66,7 +66,7 @@ public class PermissionDescriptor {
      **/
     public PermissionDescriptor(PrivilegeDescriptor privilege,
                                 ACSObject acsObject, Party party) {
-        Assert.assertNotNull(acsObject, "ACSObject acsObject");
+        Assert.exists(acsObject, "ACSObject acsObject");
 
         if (party != null) {
             m_partyOID = party.getOID();
@@ -74,7 +74,7 @@ public class PermissionDescriptor {
             m_partyOID = null;
         }
         m_acsObjectOID = acsObject.getOID();
-        Assert.assertNotNull(privilege, "privilege");
+        Assert.exists(privilege, "privilege");
         m_privilege = privilege;
     }
 
@@ -126,7 +126,7 @@ public class PermissionDescriptor {
         }
         m_acsObjectOID = acsObjectOID;
 
-        Assert.assertNotNull(privilege, "privilege");
+        Assert.exists(privilege, "privilege");
         m_privilege = privilege;
     }
 
diff --git a/ccm-core/src/com/arsdigita/kernel/ui/BasicResourceConfigFormSection.java b/ccm-core/src/com/arsdigita/kernel/ui/BasicResourceConfigFormSection.java
index 44a81fbc1..a8d467109 100755
--- a/ccm-core/src/com/arsdigita/kernel/ui/BasicResourceConfigFormSection.java
+++ b/ccm-core/src/com/arsdigita/kernel/ui/BasicResourceConfigFormSection.java
@@ -56,8 +56,8 @@ public class BasicResourceConfigFormSection
      **/
     public BasicResourceConfigFormSection(ResourceType resType,
                                           RequestLocal parentResourceRL) {
-        Assert.assertNotNull(resType, "resType may not be null");
-        Assert.assertNotNull(parentResourceRL, "parentResourceRL may not be null");
+        Assert.exists(resType, "resType may not be null");
+        Assert.exists(parentResourceRL, "parentResourceRL may not be null");
         m_resourceRL = null;
 
         setup();
@@ -71,7 +71,7 @@ public class BasicResourceConfigFormSection
      * Constructs form section for application modification
      **/
     public BasicResourceConfigFormSection(RequestLocal resource) {
-        Assert.assertNotNull(resource);
+        Assert.exists(resource);
         m_resourceRL = resource;
 
         setup();
@@ -117,9 +117,9 @@ public class BasicResourceConfigFormSection
     }
 
     public Resource createResource(PageState ps) {
-        Assert.assertNotNull(m_resourceTypeID,
+        Assert.exists(m_resourceTypeID,
                              "BigDecimal m_resourceTypeID");
-        Assert.assertNotNull(m_parentResourceRL,
+        Assert.exists(m_parentResourceRL,
                              "RequestLocal m_parentResourceRL");
 
         ResourceType at =
diff --git a/ccm-core/src/com/arsdigita/kernel/ui/PartySearchSelect.java b/ccm-core/src/com/arsdigita/kernel/ui/PartySearchSelect.java
index 9412f25e0..b35331583 100755
--- a/ccm-core/src/com/arsdigita/kernel/ui/PartySearchSelect.java
+++ b/ccm-core/src/com/arsdigita/kernel/ui/PartySearchSelect.java
@@ -191,7 +191,7 @@ public class PartySearchSelect
          * @pre basePartyCollection.get() instanceof PartyCollection
          **/
         public Search (RequestLocal basePartyCollection) {
-            Assert.assertTrue(basePartyCollection != null);
+            Assert.isTrue(basePartyCollection != null);
 
             m_partyQuery = basePartyCollection;
 
diff --git a/ccm-core/src/com/arsdigita/messaging/MessageThread.java b/ccm-core/src/com/arsdigita/messaging/MessageThread.java
index 6a69c8f24..9a12b0c8d 100755
--- a/ccm-core/src/com/arsdigita/messaging/MessageThread.java
+++ b/ccm-core/src/com/arsdigita/messaging/MessageThread.java
@@ -195,7 +195,7 @@ public class MessageThread extends ACSObject {
      * @pre msg.getThread().equals(this)
      */
     void updateForNewMessage(ThreadedMessage msg) {
-        Assert.assertTrue(msg.getThread().equals(this));
+        Assert.isTrue(msg.getThread().equals(this));
         setLatestUpdateDate(msg.getSentDate());
         incrNumberOfReplies();
     }
@@ -210,7 +210,7 @@ public class MessageThread extends ACSObject {
      * @pre msg.getThread().equals(this)
      */
     void removeMessage(ThreadedMessage msg) {
-        Assert.assertTrue(msg.getThread().equals(this));
+        Assert.isTrue(msg.getThread().equals(this));
         decrNumberOfReplies();
     }
 
diff --git a/ccm-core/src/com/arsdigita/metadata/DynamicAssociation.java b/ccm-core/src/com/arsdigita/metadata/DynamicAssociation.java
index 49dc2734c..67f397ac4 100755
--- a/ccm-core/src/com/arsdigita/metadata/DynamicAssociation.java
+++ b/ccm-core/src/com/arsdigita/metadata/DynamicAssociation.java
@@ -239,8 +239,8 @@ public class DynamicAssociation extends DynamicElement {
 
             Property p2 = type1.getProperty(m_prop2.getName());
             Property p1 = type2.getProperty(m_prop1.getName());
-            Assert.assertTrue(p2==null || p2==m_prop2);
-            Assert.assertTrue(p1==null || p1==m_prop1);
+            Assert.isTrue(p2==null || p2==m_prop2);
+            Assert.isTrue(p1==null || p1==m_prop1);
             if (p2 == null) {
                 type1.addProperty(m_prop2);
             }
diff --git a/ccm-core/src/com/arsdigita/mimetypes/MimeTypeInitializer.java b/ccm-core/src/com/arsdigita/mimetypes/MimeTypeInitializer.java
index 87377a3d2..9b605f502 100755
--- a/ccm-core/src/com/arsdigita/mimetypes/MimeTypeInitializer.java
+++ b/ccm-core/src/com/arsdigita/mimetypes/MimeTypeInitializer.java
@@ -124,7 +124,7 @@ public class MimeTypeInitializer extends BaseInitializer {
             return;
         }
 
-        Assert.truth(DbHelper.getDatabase() == DbHelper.DB_ORACLE,
+        Assert.isTrue(DbHelper.getDatabase() == DbHelper.DB_ORACLE,
                      "Testing INSO filter on non Oracle DB! Shouldn't happen!");
 
         s_log.info("Starting INSO filter test.  If server hangs here,\n" +
diff --git a/ccm-core/src/com/arsdigita/persistence/DataQueryImpl.java b/ccm-core/src/com/arsdigita/persistence/DataQueryImpl.java
index 57e58d34b..9400892a4 100755
--- a/ccm-core/src/com/arsdigita/persistence/DataQueryImpl.java
+++ b/ccm-core/src/com/arsdigita/persistence/DataQueryImpl.java
@@ -253,7 +253,7 @@ class DataQueryImpl implements DataQuery {
         if (requiresFetching) {
             m_signature.addPath(path);
         } else {
-            Assert.truth(m_signature.exists(path));
+            Assert.isTrue(m_signature.exists(path));
         }
     }
 
diff --git a/ccm-core/src/com/arsdigita/persistence/TransactionContext.java b/ccm-core/src/com/arsdigita/persistence/TransactionContext.java
index e72387f5d..9009ba4c9 100755
--- a/ccm-core/src/com/arsdigita/persistence/TransactionContext.java
+++ b/ccm-core/src/com/arsdigita/persistence/TransactionContext.java
@@ -169,7 +169,7 @@ public class TransactionContext {
      * before the transaction
      */
     private void fireBeforeCommitEvent() {
-        Assert.assertTrue
+        Assert.isTrue
 	    (inTxn(), "The beforeCommit event was fired outside of " +
 	     "the transaction");
 
@@ -190,7 +190,7 @@ public class TransactionContext {
      * after the transaction
      */
     private void fireCommitEvent() {
-        Assert.assertTrue
+        Assert.isTrue
 	    (!inTxn(), "transaction commit event fired during transaction");
 
         Object listeners[] = m_listeners.toArray();
@@ -204,7 +204,7 @@ public class TransactionContext {
             listener.afterCommit(this);
         }
 
-        Assert.assertTrue
+        Assert.isTrue
 	    (!inTxn(), "transaction commit listener didn't close transaction");
     }
 
@@ -214,7 +214,7 @@ public class TransactionContext {
      * before the transaction
      */
     private void fireBeforeAbortEvent() {
-        Assert.assertTrue
+        Assert.isTrue
 	    (inTxn(), "The beforeAbort event was fired outside of " +
 	     "the transaction");
 
@@ -234,7 +234,7 @@ public class TransactionContext {
      * after the transaction
      */
     private void fireAbortEvent() {
-        Assert.assertTrue
+        Assert.isTrue
 	    (!inTxn(), "transaction abort event fired during transaction");
 
         Object listeners[] = m_listeners.toArray();
@@ -248,7 +248,7 @@ public class TransactionContext {
             listener.afterAbort(this);
         }
 
-        Assert.assertTrue
+        Assert.isTrue
 	    (!inTxn(), "transaction abort listener didn't close transaction");
     }
 
diff --git a/ccm-core/src/com/arsdigita/persistence/metadata/ObjectType.java b/ccm-core/src/com/arsdigita/persistence/metadata/ObjectType.java
index 733d11876..afd19a48d 100755
--- a/ccm-core/src/com/arsdigita/persistence/metadata/ObjectType.java
+++ b/ccm-core/src/com/arsdigita/persistence/metadata/ObjectType.java
@@ -32,12 +32,11 @@ import java.util.Iterator;
  *
  * @author rhs@mit.edu
  * @version $Revision: #19 $ $Date: 2004/08/16 $
+ * @version $Id: ObjectType.java 287 2005-02-22 00:29:02Z sskracic $
  **/
 
 public class ObjectType extends CompoundType {
 
-    public final static String versionId = "$Id: ObjectType.java 287 2005-02-22 00:29:02Z sskracic $ by $Author: sskracic $, $DateTime: 2004/08/16 18:10:38 $";
-
     static ObjectType
 	wrap(com.redhat.persistence.metadata.ObjectType type) {
 	if (type == null) {
@@ -242,9 +241,8 @@ public class ObjectType extends CompoundType {
 
 
     /**
-     * Checks if the ObjectType specified by
-     * extendedType is a subtype of the ObjectType
-     * specified by baseType.
+     * Checks if the ObjectType specified by extendedType
+     * is a subtype of the ObjectType specified by baseType.
      *
      * @param baseType The base object type.
      * @param extendedType The extended object type.
@@ -276,7 +274,7 @@ public class ObjectType extends CompoundType {
                                      ObjectType extendedType) {
         ObjectType baseObjectType =
 	    MetadataRoot.getMetadataRoot().getObjectType(baseType);
-        Assert.assertTrue(baseObjectType != null,
+        Assert.isTrue(baseObjectType != null,
 			  "Could not find the ObjectType for the " +
                           "base type.  The base type was: " + baseType + ".");
         verifySubtype(baseObjectType, extendedType);
diff --git a/ccm-core/src/com/arsdigita/persistence/pdl/PDL.java b/ccm-core/src/com/arsdigita/persistence/pdl/PDL.java
index 337dfda2e..8c00a18b1 100755
--- a/ccm-core/src/com/arsdigita/persistence/pdl/PDL.java
+++ b/ccm-core/src/com/arsdigita/persistence/pdl/PDL.java
@@ -400,7 +400,7 @@ public class PDL {
             return;
         }
 
-        Assert.assertTrue(base.isDirectory(), "directory " + base +
+        Assert.isTrue(base.isDirectory(), "directory " + base +
                           " is directory");
 
         final String suffix = DbHelper.getDatabaseSuffix();
diff --git a/ccm-core/src/com/arsdigita/persistence/pdl/SQLRegressionGenerator.java b/ccm-core/src/com/arsdigita/persistence/pdl/SQLRegressionGenerator.java
index d0986eb72..fc2f24279 100755
--- a/ccm-core/src/com/arsdigita/persistence/pdl/SQLRegressionGenerator.java
+++ b/ccm-core/src/com/arsdigita/persistence/pdl/SQLRegressionGenerator.java
@@ -210,7 +210,7 @@ public class SQLRegressionGenerator {
 
         com.redhat.persistence.metadata.ObjectType protoType =
             root.getRoot().getObjectType(type.getQualifiedName());
-        Assert.truth(protoType != null,
+        Assert.isTrue(protoType != null,
                      "null proto type for " + type.getQualifiedName());
 
         Column key;
diff --git a/ccm-core/src/com/arsdigita/populate/Utilities.java b/ccm-core/src/com/arsdigita/populate/Utilities.java
index 9abaaea80..caadbcab0 100755
--- a/ccm-core/src/com/arsdigita/populate/Utilities.java
+++ b/ccm-core/src/com/arsdigita/populate/Utilities.java
@@ -110,7 +110,7 @@ public class Utilities {
             uc.filter(KernelHelper.getSystemAdministratorEmailAddress());
             uc.next();
             User sysadmin = uc.getUser();
-            Assert.assertNotNull(sysadmin);
+            Assert.exists(sysadmin);
             uc.close();
     
             return sysadmin;
diff --git a/ccm-core/src/com/arsdigita/populate/apps/Initializer.java b/ccm-core/src/com/arsdigita/populate/apps/Initializer.java
index 9cd184889..cdd9904d2 100755
--- a/ccm-core/src/com/arsdigita/populate/apps/Initializer.java
+++ b/ccm-core/src/com/arsdigita/populate/apps/Initializer.java
@@ -74,7 +74,7 @@ public class Initializer extends BaseInitializer {
 		int iSize = popAppsList.size();
 		for (int i = 0; i < iSize; i++) {
 			List popAppParam = (List) popAppsList.get(i);
-			Assert.assertTrue(popAppParam.size() == 2);
+			Assert.isTrue(popAppParam.size() == 2);
 
 			String sPopApp = (String) popAppParam.get(0);
 			s_log.debug("PopulateApp is " + sPopApp);
diff --git a/ccm-core/src/com/arsdigita/populate/apps/PopulateAppPair.java b/ccm-core/src/com/arsdigita/populate/apps/PopulateAppPair.java
index 8a132c183..5a7be8512 100755
--- a/ccm-core/src/com/arsdigita/populate/apps/PopulateAppPair.java
+++ b/ccm-core/src/com/arsdigita/populate/apps/PopulateAppPair.java
@@ -30,7 +30,7 @@ public class PopulateAppPair {
     private List m_args;
     
     public PopulateAppPair(List popAppPair) {
-        Assert.assertTrue(popAppPair.size() == 2);
+        Assert.isTrue(popAppPair.size() == 2);
         m_popApp = (PopulateApp)popAppPair.get(0);
         m_args = (List)popAppPair.get(1);
     }
diff --git a/ccm-core/src/com/arsdigita/portal/Portal.java b/ccm-core/src/com/arsdigita/portal/Portal.java
index 129e7ddb7..d31e9be3e 100755
--- a/ccm-core/src/com/arsdigita/portal/Portal.java
+++ b/ccm-core/src/com/arsdigita/portal/Portal.java
@@ -281,7 +281,7 @@ public class Portal extends Resource {
      *
      * @param portlet the portlet instance to add.
      * @param cellNumber the cell in which to place this portlet.  cellNumber's
-     * value must be greater than or equal to 1.
+     * value must be greater than or isEqual to 1.
      * @pre portlet != null
      * @pre cellNumber >= 1
      */
@@ -397,7 +397,7 @@ public class Portal extends Resource {
         LinkedList portletList = getPortletListForCell(portlet.getCellNumber());
         int currentIndex = portletList.indexOf(portlet);
 
-        Assert.truth(currentIndex != -1, "Portlet not found.");
+        Assert.isTrue(currentIndex != -1, "Portlet not found.");
 
         synchronized (portletList) {
             portletList.remove(currentIndex);
diff --git a/ccm-core/src/com/arsdigita/portal/PortletSetup.java b/ccm-core/src/com/arsdigita/portal/PortletSetup.java
index a1712c0f7..7c4c5568c 100755
--- a/ccm-core/src/com/arsdigita/portal/PortletSetup.java
+++ b/ccm-core/src/com/arsdigita/portal/PortletSetup.java
@@ -30,7 +30,8 @@ import java.util.ArrayList;
 
 /**
  *
- * 

This class is a convenience class for easily initializing a Portlet.

+ *

This class is a convenience class for easily initializing a Portlet + * wrapping {@link PortletType} class.

*

* The usage pattern for this class is: *

    @@ -48,10 +49,6 @@ import java.util.ArrayList; */ public class PortletSetup { - // public static final String versionId = - // "$Id: PortletSetup.java 287 2005-02-22 00:29:02Z sskracic $" + - // "by $Author: sskracic $, $DateTime: 2004/08/16 18:10:38 $"; - protected String m_profile; protected String m_key = null; protected String m_typeName = null; @@ -106,7 +103,7 @@ public class PortletSetup { ApplicationType.retrieveApplicationTypeForApplication (applicationObjectType); - Assert.assertNotNull(provider, "provider"); + Assert.exists(provider, "provider"); setProviderApplicationType(provider); } diff --git a/ccm-core/src/com/arsdigita/portal/PortletType.java b/ccm-core/src/com/arsdigita/portal/PortletType.java index 0adad031f..89c20c24d 100755 --- a/ccm-core/src/com/arsdigita/portal/PortletType.java +++ b/ccm-core/src/com/arsdigita/portal/PortletType.java @@ -48,29 +48,44 @@ import com.arsdigita.web.Web; */ public class PortletType extends ResourceType { + /** The logging object for this class. */ private static final Logger s_cat = Logger.getLogger(PortletType.class.getName()); - // PortletType uses the data object type of ApplicationType. + /** + * The fully qualified model name of the underlying data object, which in + * this case is the same as the Java type. + * PortletType uses the data object type of ApplicationType. + */ public static final String BASE_DATA_OBJECT_TYPE = "com.arsdigita.portal.PortletType"; - - protected String getBaseDataObjectType() { - return BASE_DATA_OBJECT_TYPE; - } - public static final String WIDE_PROFILE = "wide"; public static final String NARROW_PROFILE = "narrow"; + // ===== Constructors ==================================================== // + + /** + * Creates a new PortletType object instance to encapsulate a given data object. + * Do not instantiate directly, use createPortletType(...) instead! + * @param dataObject + */ protected PortletType(DataObject dataObject) { super(dataObject); } - // Create from packageType. - protected PortletType - (String dataObjectType, String title, String profile, - String portletObjectType) { + /** + * Create a new Portlet from packageType. + * Do not instantiate directly, use createPortletType(...) instead! + * @param dataObjectType + * @param title + * @param profile + * @param portletObjectType + */ + protected PortletType(String dataObjectType, + String title, String profile, + String portletObjectType) { + super(dataObjectType); Assert.exists(title, "title"); @@ -85,9 +100,7 @@ public class PortletType extends ResourceType { String message = "The PackageType 'portal' is not installed. It must be " + "installed in order to create a new PortletType."; - s_cat.error(message); - throw new IllegalStateException(message); } @@ -100,8 +113,12 @@ public class PortletType extends ResourceType { setEmbeddedView(true); } - public static PortletType createPortletType - (String title, String profile, String portletObjectType) { + protected String getBaseDataObjectType() { + return BASE_DATA_OBJECT_TYPE; + } + + public static PortletType createPortletType(String title, String profile, + String portletObjectType) { return new PortletType (BASE_DATA_OBJECT_TYPE, title, profile, portletObjectType); } @@ -229,100 +246,111 @@ public class PortletType extends ResourceType { private static Set s_xsl = new HashSet(); /** - * - * NB - Based on ccm-cms/com.arsdigita.cms.ContentType - * interface is liable to change. - * - * Registers an XSL file against a portlet type. - * @param portletType the portlet's base data object type - * @param path the path relative to the server root - */ - public static void registerXSLFile(String portletType, String path) { - s_cat.debug("registering xsl file " + path + " to portlet type " - + portletType); + * Registers an XSL file against a portlet type. + * + * NB - Based on ccm-cms/com.arsdigita.cms.ContentType + * interface is liable to change. + * + * @param portletType the portlet's base data object type + * @param path the path relative to the server root + */ + public static void registerXSLFile(String portletType, String path) { - s_xsl.add(new XSLEntry(portletType, path)); - } + s_cat.debug("registering xsl file " + path + " to portlet type " + + portletType); - /** - * NB this interface is liable to change. - * - * Unregisters an XSL file against a content type. - * @param type the content type - * @param path the path relative to the server root - */ - public static void unregisterXSLFile(String portletType, String path) { - s_xsl.remove(new XSLEntry(portletType, path)); - } + s_xsl.add(new XSLEntry(portletType, path)); + } - /** - * Gets an iterator of java.net.URL objects for - * all registered XSL files - */ - public static Iterator getXSLFileURLs() { - s_cat.debug("getXSLFileURLs - returningan iterator over " - + s_xsl.size() + " entries"); - return new EntryIterator(s_xsl.iterator()); - } + /** + * Unregisters an XSL file against a content type. + * + * NB this interface is liable to change. + * + * @param type the content type + * @param path the path relative to the server root + */ + public static void unregisterXSLFile(String portletType, String path) { + s_xsl.remove(new XSLEntry(portletType, path)); + } - private static class EntryIterator implements Iterator { - private Iterator m_inner; + /** + * Gets an iterator of java.net.URL objects for + * all registered XSL files + */ + public static Iterator getXSLFileURLs() { + s_cat.debug("getXSLFileURLs - returningan iterator over " + + s_xsl.size() + " entries"); + return new EntryIterator(s_xsl.iterator()); + } - public EntryIterator(Iterator inner) { - m_inner = inner; - } + /** + * + */ + private static class EntryIterator implements Iterator { - public boolean hasNext() { - return m_inner.hasNext(); - } + private Iterator m_inner; - public Object next() { - XSLEntry entry = (XSLEntry) m_inner.next(); - String path = entry.getPath(); + public EntryIterator(Iterator inner) { + m_inner = inner; + } - try { - return new URL(Web.getConfig().getDefaultScheme(), Web - .getConfig().getHost().getName(), Web.getConfig() - .getHost().getPort(), path); - } catch (MalformedURLException ex) { - throw new UncheckedWrapperException("path malformed" + path, ex); - } - } + public boolean hasNext() { + return m_inner.hasNext(); + } - public void remove() { - m_inner.remove(); - } - } + public Object next() { - private static class XSLEntry { - private String m_type; + XSLEntry entry = (XSLEntry) m_inner.next(); + String path = entry.getPath(); - private String m_path; + try { + return new URL(Web.getConfig().getDefaultScheme(), + Web.getConfig().getHost().getName(), + Web.getConfig().getHost().getPort(), path); + } catch (MalformedURLException ex) { + throw new UncheckedWrapperException("path malformed" + path, ex); + } + } - public XSLEntry(String portletType, String path) { - m_type = portletType; - m_path = path; - } + public void remove() { + m_inner.remove(); + } + } - public PortletType getType() { - return PortletType.retrievePortletTypeForPortlet(m_type); - } + /** + * + */ + private static class XSLEntry { - public String getPath() { - return m_path; - } + private String m_type; - public boolean equals(Object o) { - if (!(o instanceof XSLEntry)) { - return false; - } - XSLEntry e = (XSLEntry) o; - return m_path.equals(e.m_path) && m_type.equals(e.m_type); - } + private String m_path; - public int hashCode() { - return m_path.hashCode() + m_type.hashCode(); - } - } + public XSLEntry(String portletType, String path) { + m_type = portletType; + m_path = path; + } + + public PortletType getType() { + return PortletType.retrievePortletTypeForPortlet(m_type); + } + + public String getPath() { + return m_path; + } + + public boolean equals(Object o) { + if (!(o instanceof XSLEntry)) { + return false; + } + XSLEntry e = (XSLEntry) o; + return m_path.equals(e.m_path) && m_type.equals(e.m_type); + } + + public int hashCode() { + return m_path.hashCode() + m_type.hashCode(); + } + } } diff --git a/ccm-core/src/com/arsdigita/portal/apportlet/AppPortletType.java b/ccm-core/src/com/arsdigita/portal/apportlet/AppPortletType.java index b47cd400a..bd6974196 100755 --- a/ccm-core/src/com/arsdigita/portal/apportlet/AppPortletType.java +++ b/ccm-core/src/com/arsdigita/portal/apportlet/AppPortletType.java @@ -54,36 +54,36 @@ public final class AppPortletType extends PortletType { public static AppPortletType retrieveAppPortletType(BigDecimal id) { - Assert.assertNotNull(id, "id"); + Assert.exists(id, "id"); return AppPortletType.retrieveAppPortletType (new OID(BASE_DATA_OBJECT_TYPE, id)); } public static AppPortletType retrieveAppPortletType(OID oid) { - Assert.assertNotNull(oid, "oid"); + Assert.exists(oid, "oid"); DataObject dataObject = SessionManager.getSession().retrieve(oid); - Assert.assertNotNull(dataObject); + Assert.exists(dataObject); return AppPortletType.retrieveAppPortletType(dataObject); } public static AppPortletType retrieveAppPortletType(DataObject dataObject) { - Assert.assertNotNull(dataObject, "dataObject"); + Assert.exists(dataObject, "dataObject"); return new AppPortletType(dataObject); } public static AppPortletType retrieveAppPortletTypeForAppPortlet (String portletObjectType) { - Assert.assertNotNull(portletObjectType, "portletObjectType"); + Assert.exists(portletObjectType, "portletObjectType"); DataCollection collection = SessionManager.getSession().retrieve(BASE_DATA_OBJECT_TYPE); - Assert.assertNotNull(collection, "collection"); + Assert.exists(collection, "collection"); collection.addEqualsFilter("objectType", portletObjectType); @@ -117,7 +117,7 @@ public final class AppPortletType extends PortletType { Boolean isPortalApplication = (Boolean) get(IS_PORTAL_APPLICATION); - Assert.assertNotNull(isPortalApplication, IS_PORTAL_APPLICATION); + Assert.exists(isPortalApplication, IS_PORTAL_APPLICATION); return isPortalApplication.booleanValue(); } diff --git a/ccm-core/src/com/arsdigita/search/FilterSpecification.java b/ccm-core/src/com/arsdigita/search/FilterSpecification.java index eda34730b..71c6fe995 100755 --- a/ccm-core/src/com/arsdigita/search/FilterSpecification.java +++ b/ccm-core/src/com/arsdigita/search/FilterSpecification.java @@ -52,7 +52,7 @@ public abstract class FilterSpecification { FilterType type) { Assert.exists(values, Object.class); Assert.exists(type, FilterType.class); - Assert.truth(values.length % 2 == 0, "length of value list is even"); + Assert.isTrue(values.length % 2 == 0, "length of value list is even"); m_values = new HashMap(); for (int i = 0 ; i < (values.length / 2) ; i++) { @@ -90,7 +90,7 @@ public abstract class FilterSpecification { } /** - * Two filter specifications are considered equal + * Two filter specifications are considered isEqual * if they refer to the same filter type * and their parameter sets contain the same * (key, value) pairs diff --git a/ccm-core/src/com/arsdigita/search/FilterType.java b/ccm-core/src/com/arsdigita/search/FilterType.java index 73826ad1e..3c9e54ea1 100755 --- a/ccm-core/src/com/arsdigita/search/FilterType.java +++ b/ccm-core/src/com/arsdigita/search/FilterType.java @@ -64,7 +64,7 @@ public abstract class FilterType { /** * Two filter type objects compare - * equal if they have the same filter + * isEqual if they have the same filter * key */ public boolean equals(Object o) { diff --git a/ccm-core/src/com/arsdigita/search/QuerySpecification.java b/ccm-core/src/com/arsdigita/search/QuerySpecification.java index 74b52db8a..34ecee659 100755 --- a/ccm-core/src/com/arsdigita/search/QuerySpecification.java +++ b/ccm-core/src/com/arsdigita/search/QuerySpecification.java @@ -111,7 +111,7 @@ public class QuerySpecification { } /** - * Two query specifications compare equal if they + * Two query specifications compare isEqual if they * have the same search term, have the same setting * for partial matches and contain the same set of * filter specifications. diff --git a/ccm-core/src/com/arsdigita/search/intermedia/BaseQueryEngine.java b/ccm-core/src/com/arsdigita/search/intermedia/BaseQueryEngine.java index f02a670d3..4484f754a 100755 --- a/ccm-core/src/com/arsdigita/search/intermedia/BaseQueryEngine.java +++ b/ccm-core/src/com/arsdigita/search/intermedia/BaseQueryEngine.java @@ -194,18 +194,18 @@ public class BaseQueryEngine extends LockableImpl implements QueryEngine { protected void addColumn(String field, String propName) { - Assert.unlocked(this); + Assert.isUnlocked(this); m_columns.put(field, propName); } protected void addTable(String table, String alias) { - Assert.unlocked(this); + Assert.isUnlocked(this); m_tables.put(table, alias); } protected void addCondition(String condition) { - Assert.unlocked(this); + Assert.isUnlocked(this); m_conditions.add(condition); } @@ -220,7 +220,7 @@ public class BaseQueryEngine extends LockableImpl implements QueryEngine { protected void addFilters(DataQuery query, FilterSpecification[] filters) { - Assert.locked(this); + Assert.isLocked(this); for (int i = 0 ; i < filters.length ; i++) { s_log.debug("adding filter " + filters[i]); @@ -230,7 +230,7 @@ public class BaseQueryEngine extends LockableImpl implements QueryEngine { protected void addFilter(DataQuery query, FilterSpecification filter) { - Assert.locked(this); + Assert.isLocked(this); FilterType type = filter.getType(); @@ -248,7 +248,7 @@ public class BaseQueryEngine extends LockableImpl implements QueryEngine { protected void addPermissionFilter(DataQuery query, PermissionFilterSpecification filter) { - Assert.locked(this); + Assert.isLocked(this); PermissionService.filterQuery(query, "object_id", @@ -258,7 +258,7 @@ public class BaseQueryEngine extends LockableImpl implements QueryEngine { protected void addObjectTypeFilter(DataQuery query, ObjectTypeFilterSpecification filter) { - Assert.locked(this); + Assert.isLocked(this); List l = new ArrayList(); ObjectType[] types = filter.getTypes(); @@ -281,7 +281,7 @@ public class BaseQueryEngine extends LockableImpl implements QueryEngine { protected void addCategoryFilter(DataQuery query, CategoryFilterSpecification filter) { - Assert.locked(this); + Assert.isLocked(this); Category[] categories = filter.getCategories(); if (categories != null && categories.length > 0) { @@ -302,7 +302,7 @@ public class BaseQueryEngine extends LockableImpl implements QueryEngine { protected void addContentSectionFilter(DataQuery query, ContentSectionFilterSpecification filter) { - Assert.locked(this); + Assert.isLocked(this); Object[] contentSections = filter.getSections(); s_log.debug("there are " + contentSections.length + " contentSections"); diff --git a/ccm-core/src/com/arsdigita/search/intermedia/BuildIndex.java b/ccm-core/src/com/arsdigita/search/intermedia/BuildIndex.java index 3453cac87..b0cac9583 100755 --- a/ccm-core/src/com/arsdigita/search/intermedia/BuildIndex.java +++ b/ccm-core/src/com/arsdigita/search/intermedia/BuildIndex.java @@ -268,7 +268,7 @@ class BuildIndex { } private static boolean shouldSyncAgain( IndexingTime it) { - Assert.truth(it.getJobStatus().equals("finished")); + Assert.isTrue(it.getJobStatus().equals("finished")); final long timeLastChange = ContentChangeTime.getContentChangeTime(); diff --git a/ccm-core/src/com/arsdigita/search/intermedia/DataQueryResultSet.java b/ccm-core/src/com/arsdigita/search/intermedia/DataQueryResultSet.java index a2f468238..566ce4ce1 100755 --- a/ccm-core/src/com/arsdigita/search/intermedia/DataQueryResultSet.java +++ b/ccm-core/src/com/arsdigita/search/intermedia/DataQueryResultSet.java @@ -109,7 +109,7 @@ class DataQueryResultSet implements ResultSet { } public Object next() { - Assert.truth(m_hasNext, "hasNext"); + Assert.isTrue(m_hasNext, "hasNext"); BaseDocument result = m_current; peekNext(); diff --git a/ccm-core/src/com/arsdigita/search/lucene/DocumentObserver.java b/ccm-core/src/com/arsdigita/search/lucene/DocumentObserver.java index 66dad3e1a..be153aff9 100755 --- a/ccm-core/src/com/arsdigita/search/lucene/DocumentObserver.java +++ b/ccm-core/src/com/arsdigita/search/lucene/DocumentObserver.java @@ -88,7 +88,7 @@ public class DocumentObserver implements com.arsdigita.search.DocumentObserver { ContentType.TEXT); StringBuffer buf = new StringBuffer(""); for (int i = 0 ; i < content.length ; i++) { - Assert.truth(content[i].getType().equals(ContentType.TEXT), + Assert.isTrue(content[i].getType().equals(ContentType.TEXT), "content is text"); buf.append(new String(content[i].getBytes())); } diff --git a/ccm-core/src/com/arsdigita/search/ui/QueryComponent.java b/ccm-core/src/com/arsdigita/search/ui/QueryComponent.java index ee77a9dbc..022634c46 100755 --- a/ccm-core/src/com/arsdigita/search/ui/QueryComponent.java +++ b/ccm-core/src/com/arsdigita/search/ui/QueryComponent.java @@ -56,7 +56,7 @@ public abstract class QueryComponent extends SimpleContainer * Returns the current query specification */ public QuerySpecification getQuerySpecification(PageState state) { - Assert.truth(hasQuery(state)); + Assert.isTrue(hasQuery(state)); String terms = getTerms(state); diff --git a/ccm-core/src/com/arsdigita/sitenode/SiteNodeDispatcher.java b/ccm-core/src/com/arsdigita/sitenode/SiteNodeDispatcher.java index cdf8237c8..2d9de25fe 100755 --- a/ccm-core/src/com/arsdigita/sitenode/SiteNodeDispatcher.java +++ b/ccm-core/src/com/arsdigita/sitenode/SiteNodeDispatcher.java @@ -171,7 +171,7 @@ public class SiteNodeDispatcher extends KernelDispatcherServlet DispatcherHelper.setRequest(req); - Assert.assertNotNull(rc, "rc"); + Assert.exists(rc, "rc"); SiteNode sn = getSiteNode(req, rc); diff --git a/ccm-core/src/com/arsdigita/templating/URLPatternGenerator.java b/ccm-core/src/com/arsdigita/templating/URLPatternGenerator.java index 1274dc3d0..9f116bab8 100755 --- a/ccm-core/src/com/arsdigita/templating/URLPatternGenerator.java +++ b/ccm-core/src/com/arsdigita/templating/URLPatternGenerator.java @@ -135,7 +135,7 @@ public class URLPatternGenerator implements PatternGenerator { s_log.debug("Base is " + base + " url is " + url); } - Assert.truth(url.startsWith(base), "URL " + url + " starts with " + base); + Assert.isTrue(url.startsWith(base), "URL " + url + " starts with " + base); return url.substring(base.length()-1); } diff --git a/ccm-core/src/com/arsdigita/templating/html/PairImpl.java b/ccm-core/src/com/arsdigita/templating/html/PairImpl.java index ff0a4670a..d842a9df6 100755 --- a/ccm-core/src/com/arsdigita/templating/html/PairImpl.java +++ b/ccm-core/src/com/arsdigita/templating/html/PairImpl.java @@ -46,12 +46,12 @@ final class PairImpl implements AttributeMap.Pair { } public void setName(String qName) { - Assert.assertNotNull(qName, "qName"); + Assert.exists(qName, "qName"); m_qName = qName; } public void setValue(String value) { - Assert.assertNotNull(value, "value"); + Assert.exists(value, "value"); m_value = value; } } diff --git a/ccm-core/src/com/arsdigita/templating/html/StringTemplate.java b/ccm-core/src/com/arsdigita/templating/html/StringTemplate.java index 10567dc40..430d67c5c 100755 --- a/ccm-core/src/com/arsdigita/templating/html/StringTemplate.java +++ b/ccm-core/src/com/arsdigita/templating/html/StringTemplate.java @@ -54,7 +54,7 @@ public class StringTemplate { * placeholder, i.e., it is equivalent to "foo$bar".

    **/ public StringTemplate(String htmlFragment) { - Assert.assertNotNull(htmlFragment, "htmlFragment"); + Assert.exists(htmlFragment, "htmlFragment"); m_fragments = new ArrayList(); m_bindVars = new ArrayList(); diff --git a/ccm-core/src/com/arsdigita/templating/html/demo/DemoTagHandler.java b/ccm-core/src/com/arsdigita/templating/html/demo/DemoTagHandler.java index 652bf41ed..2c3d7c384 100755 --- a/ccm-core/src/com/arsdigita/templating/html/demo/DemoTagHandler.java +++ b/ccm-core/src/com/arsdigita/templating/html/demo/DemoTagHandler.java @@ -163,7 +163,7 @@ public class DemoTagHandler implements ContentHandler { } public boolean isValid(String qName) { - Assert.assertNotNull(qName, "element"); + Assert.exists(qName, "element"); return m_handlers.containsKey(qName); } @@ -338,9 +338,9 @@ public class DemoTagHandler implements ContentHandler { private int m_level; public HeaderTag(String tagName) { - Assert.assertNotNull(tagName, "tagName"); + Assert.exists(tagName, "tagName"); m_tagName = tagName.toLowerCase(); - Assert.assertTrue + Assert.isTrue (H0_TAG.equals(tagName) || H1_TAG.equals(tagName) || H2_TAG.equals(tagName) || H3_TAG.equals(tagName), tagName + " is not a supported header tag."); @@ -352,7 +352,7 @@ public class DemoTagHandler implements ContentHandler { * to h1 is -1. **/ public int distanceTo(HeaderTag tag) { - Assert.assertNotNull(tag, "tag"); + Assert.exists(tag, "tag"); return tag.m_level - m_level; } diff --git a/ccm-core/src/com/arsdigita/toolbox/CharsetEncodingProvider.java b/ccm-core/src/com/arsdigita/toolbox/CharsetEncodingProvider.java index 3aad4a5b3..5ed2a82c6 100755 --- a/ccm-core/src/com/arsdigita/toolbox/CharsetEncodingProvider.java +++ b/ccm-core/src/com/arsdigita/toolbox/CharsetEncodingProvider.java @@ -61,7 +61,7 @@ public class CharsetEncodingProvider implements ParameterProvider { Locale locale = Kernel.getContext().getLocale(); - Assert.assertNotNull(locale, "Locale locale"); + Assert.exists(locale, "Locale locale"); ParameterData pd = new ParameterData (s_encodingParam, Globalization.getDefaultCharset(locale)); diff --git a/ccm-core/src/com/arsdigita/toolbox/ui/AbstractCollectionTable.java b/ccm-core/src/com/arsdigita/toolbox/ui/AbstractCollectionTable.java index 4d3d44d8a..a08d09676 100755 --- a/ccm-core/src/com/arsdigita/toolbox/ui/AbstractCollectionTable.java +++ b/ccm-core/src/com/arsdigita/toolbox/ui/AbstractCollectionTable.java @@ -121,7 +121,7 @@ public abstract class AbstractCollectionTable extends Table * @pre ASCENDING.equals(direction) || DESCENDING.equals(direction) */ public void setDefaultOrderDirection(String direction) { - Assert.assertTrue(ASCENDING.equals(direction) || + Assert.isTrue(ASCENDING.equals(direction) || DESCENDING.equals(direction), "The order must " + "be either ascending or descending"); m_dirParam.setDefaultValue(direction); @@ -146,7 +146,7 @@ public abstract class AbstractCollectionTable extends Table * should be sorted; either ASCENDING or DESCENDING */ public void setOrderDirection(PageState s, String dir) { - Assert.assertTrue(ASCENDING.equals(dir) || DESCENDING.equals(dir)); + Assert.isTrue(ASCENDING.equals(dir) || DESCENDING.equals(dir)); s.setValue(m_dirParam, dir); } @@ -174,8 +174,8 @@ public abstract class AbstractCollectionTable extends Table * @param attribute the default attribute to sort by */ public void setDefaultOrder(String attribute) { - Assert.assertNotLocked(this); - Assert.assertTrue(m_columnOrder.contains(attribute), + Assert.isUnlocked(this); + Assert.isTrue(m_columnOrder.contains(attribute), "The passed in attribute '" + attribute + "' is not the name of a column."); getColumnSelectionModel().getStateParameter() diff --git a/ccm-core/src/com/arsdigita/toolbox/ui/ActionGroup.java b/ccm-core/src/com/arsdigita/toolbox/ui/ActionGroup.java index 124ac8397..05ed48a3c 100755 --- a/ccm-core/src/com/arsdigita/toolbox/ui/ActionGroup.java +++ b/ccm-core/src/com/arsdigita/toolbox/ui/ActionGroup.java @@ -50,16 +50,16 @@ public class ActionGroup extends ComponentSet { public static final String RETURN = "return"; public final void setSubject(final Component subject) { - Assert.assertNotNull(subject, "Component subject"); - Assert.assertNotLocked(this); + Assert.exists(subject, "Component subject"); + Assert.isUnlocked(this); m_subject = subject; add(m_subject); } public final void addAction(final Component action, final String clacc) { - Assert.assertNotNull(action, "Component action"); - Assert.assertNotLocked(this); + Assert.exists(action, "Component action"); + Assert.isUnlocked(this); m_actions.add(new Object[] {action, clacc}); add(action); diff --git a/ccm-core/src/com/arsdigita/toolbox/ui/ComponentMap.java b/ccm-core/src/com/arsdigita/toolbox/ui/ComponentMap.java index 96fcb8649..5221f1006 100755 --- a/ccm-core/src/com/arsdigita/toolbox/ui/ComponentMap.java +++ b/ccm-core/src/com/arsdigita/toolbox/ui/ComponentMap.java @@ -62,7 +62,7 @@ public abstract class ComponentMap extends SimpleComponent } public final void put(final Object key, final Component component) { - Assert.unlocked(this); + Assert.isUnlocked(this); Assert.exists(key, Object.class); m_components.put(key, component); diff --git a/ccm-core/src/com/arsdigita/toolbox/ui/ComponentSet.java b/ccm-core/src/com/arsdigita/toolbox/ui/ComponentSet.java index 5b5534dfe..a7afd6097 100755 --- a/ccm-core/src/com/arsdigita/toolbox/ui/ComponentSet.java +++ b/ccm-core/src/com/arsdigita/toolbox/ui/ComponentSet.java @@ -62,7 +62,7 @@ public class ComponentSet extends SimpleComponent } public final void add(final Component component) { - Assert.assertNotNull(component, "Component component"); + Assert.exists(component, "Component component"); synchronized (m_components) { final int index = m_components.indexOf(component); diff --git a/ccm-core/src/com/arsdigita/toolbox/ui/ContextBar.java b/ccm-core/src/com/arsdigita/toolbox/ui/ContextBar.java index b5069c347..9f77c59fd 100755 --- a/ccm-core/src/com/arsdigita/toolbox/ui/ContextBar.java +++ b/ccm-core/src/com/arsdigita/toolbox/ui/ContextBar.java @@ -75,7 +75,7 @@ public abstract class ContextBar extends SimpleComponent { public Entry(final String title, final String href) { super(); - Assert.assertNotNull(title, "String title"); + Assert.exists(title, "String title"); m_title = title; m_href = href; diff --git a/ccm-core/src/com/arsdigita/toolbox/ui/DataTable.java b/ccm-core/src/com/arsdigita/toolbox/ui/DataTable.java index 884eb03f7..7b68f305d 100755 --- a/ccm-core/src/com/arsdigita/toolbox/ui/DataTable.java +++ b/ccm-core/src/com/arsdigita/toolbox/ui/DataTable.java @@ -233,7 +233,7 @@ public class DataTable extends Table implements PaginationModelBuilder { * @param attribute the default attribute to sort by */ public void setDefaultOrder(String attribute) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); getOrderSelectionModel().getStateParameter() .setDefaultValue(attribute); } @@ -364,7 +364,7 @@ public class DataTable extends Table implements PaginationModelBuilder { * @param builder the new {@link DataQueryBuilder} for this table */ public void setDataQueryBuilder(DataQueryBuilder builder) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); m_builder = builder; } @@ -375,7 +375,7 @@ public class DataTable extends Table implements PaginationModelBuilder { * @param orderModel The new model */ public void setOrderSelectionModel(SingleSelectionModel orderModel) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); m_orderModel = orderModel; } @@ -393,7 +393,7 @@ public class DataTable extends Table implements PaginationModelBuilder { * @param l the new query listener */ public void addQueryListener(QueryListener l) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); m_queryListeners.add(QueryListener.class, l); } @@ -403,7 +403,7 @@ public class DataTable extends Table implements PaginationModelBuilder { * @param l the new query listener */ public void removeQueryListener(QueryListener l) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); m_queryListeners.remove(QueryListener.class, l); } @@ -462,7 +462,7 @@ public class DataTable extends Table implements PaginationModelBuilder { * should be sorted; either ASCENDING or DESCENDING */ public void setOrderDirection(PageState s, String dir) { - Assert.assertTrue(ASCENDING.equals(dir) || DESCENDING.equals(dir)); + Assert.isTrue(ASCENDING.equals(dir) || DESCENDING.equals(dir)); s.setValue(m_dirParam, dir); } @@ -526,7 +526,7 @@ public class DataTable extends Table implements PaginationModelBuilder { * if the table should not be paginated. */ public final void setPaginator(Paginator p) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); m_paginator = p; } @@ -579,7 +579,7 @@ public class DataTable extends Table implements PaginationModelBuilder { * or null if no globalization is needed */ public void setResourceBundle(String bundle) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); m_resourceBundle = bundle; } @@ -616,7 +616,7 @@ public class DataTable extends Table implements PaginationModelBuilder { * @param isSortable if true, the column will be sortable */ public void setSortable(boolean isSortable) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); m_sortable = isSortable; setHeaderRenderer(new GlobalizedHeaderCellRenderer(isSortable)); } diff --git a/ccm-core/src/com/arsdigita/toolbox/ui/ItemEditor.java b/ccm-core/src/com/arsdigita/toolbox/ui/ItemEditor.java index c01e4cd2b..f968ea13d 100755 --- a/ccm-core/src/com/arsdigita/toolbox/ui/ItemEditor.java +++ b/ccm-core/src/com/arsdigita/toolbox/ui/ItemEditor.java @@ -51,26 +51,26 @@ public class ItemEditor extends ModalContainer { public final void setSummary(final Label heading, final Component summary) { - Assert.assertNotNull(heading, "Label heading"); - Assert.assertNotNull(summary, "Component summary"); - Assert.assertNotLocked(this); + Assert.exists(heading, "Label heading"); + Assert.exists(summary, "Component summary"); + Assert.isUnlocked(this); m_heading = heading; m_summary = summary; } public final void setDetails(final Component details) { - Assert.assertNotNull(details, "Component details"); - Assert.assertNotLocked(this); + Assert.exists(details, "Component details"); + Assert.isUnlocked(this); m_details = details; } public final void setEdit(final ActionLink editLink, final Form edit) { - Assert.assertNotNull(editLink, "ActionLink editLink"); - Assert.assertNotNull(edit, "Form edit"); - Assert.assertNotLocked(this); + Assert.exists(editLink, "ActionLink editLink"); + Assert.exists(edit, "Form edit"); + Assert.isUnlocked(this); m_editLink = editLink; m_edit = edit; @@ -78,24 +78,24 @@ public class ItemEditor extends ModalContainer { public final void setDelete(final ActionLink deleteLink, final Form delete) { - Assert.assertNotNull(deleteLink, "ActionLink deleteLink"); - Assert.assertNotNull(delete, "Form delete"); - Assert.assertNotLocked(this); + Assert.exists(deleteLink, "ActionLink deleteLink"); + Assert.exists(delete, "Form delete"); + Assert.isUnlocked(this); m_deleteLink = deleteLink; m_delete = delete; } public final void setReturn(final ActionLink returnLink) { - Assert.assertNotNull(returnLink, "ActionLink returnLink"); - Assert.assertNotLocked(this); + Assert.exists(returnLink, "ActionLink returnLink"); + Assert.isUnlocked(this); m_returnLink = returnLink; } public void register(final Page page) { - Assert.assertNotNull(m_heading, "Label m_heading"); - Assert.assertNotNull(m_summary, "Component m_summary"); + Assert.exists(m_heading, "Label m_heading"); + Assert.exists(m_summary, "Component m_summary"); final SimpleContainer info = new SimpleContainer(); super.setDefaultComponent(info); diff --git a/ccm-core/src/com/arsdigita/toolbox/ui/ModalPanel.java b/ccm-core/src/com/arsdigita/toolbox/ui/ModalPanel.java index ee12029aa..f71cdb8c2 100755 --- a/ccm-core/src/com/arsdigita/toolbox/ui/ModalPanel.java +++ b/ccm-core/src/com/arsdigita/toolbox/ui/ModalPanel.java @@ -105,7 +105,7 @@ public class ModalPanel extends ComponentMap { } public final void add(final Component component) { - Assert.unlocked(this); + Assert.isUnlocked(this); Assert.exists(component, Component.class); put(component, component); @@ -126,7 +126,7 @@ public class ModalPanel extends ComponentMap { public final void push(final PageState state, final Component pushed) { if (Assert.isEnabled()) { Assert.exists(pushed, Component.class); - Assert.truth(containsKey(pushed), + Assert.isTrue(containsKey(pushed), "Component " + pushed + " is not a child " + "of this container"); } @@ -166,9 +166,9 @@ public class ModalPanel extends ComponentMap { public final void setDefault(final Component defaalt) { if (Assert.isEnabled()) { - Assert.unlocked(this); + Assert.isUnlocked(this); Assert.exists(defaalt, Component.class); - Assert.truth(containsValue(defaalt), + Assert.isTrue(containsValue(defaalt), defaalt + " is not one of my children"); } @@ -312,7 +312,7 @@ public class ModalPanel extends ComponentMap { public TableNavigationListener(final int column, final Component target) { - Assert.assertNotNull(target, "Component target"); + Assert.exists(target, "Component target"); m_column = column; m_target = target; @@ -330,7 +330,7 @@ public class ModalPanel extends ComponentMap { private final Component m_target; public FormNavigationListener(final Component target) { - Assert.assertNotNull(target, "Component target"); + Assert.exists(target, "Component target"); m_target = target; } @@ -350,9 +350,9 @@ public class ModalPanel extends ComponentMap { public WidgetNavigationListener(final Widget widget, final Object value, final Component target) { - Assert.assertNotNull(widget, "Widget widget"); - Assert.assertNotNull(value, "String value"); - Assert.assertNotNull(target, "Component target"); + Assert.exists(widget, "Widget widget"); + Assert.exists(value, "String value"); + Assert.exists(target, "Component target"); m_widget = widget; m_value = value; @@ -374,7 +374,7 @@ public class ModalPanel extends ComponentMap { private SingleSelectionModel m_model; public CancelListener(final FormSection form) { - Assert.assertNotNull(form, "FormSection form"); + Assert.exists(form, "FormSection form"); if (form instanceof Cancellable) { m_cancellable = (Cancellable) form; @@ -391,7 +391,7 @@ public class ModalPanel extends ComponentMap { final SingleSelectionModel model) { this(form); - Assert.assertNotNull(model, "SingleSelectionModel model"); + Assert.exists(model, "SingleSelectionModel model"); m_model = model; } diff --git a/ccm-core/src/com/arsdigita/toolbox/ui/PropertyList.java b/ccm-core/src/com/arsdigita/toolbox/ui/PropertyList.java index 6834cc6c0..1ae5026db 100755 --- a/ccm-core/src/com/arsdigita/toolbox/ui/PropertyList.java +++ b/ccm-core/src/com/arsdigita/toolbox/ui/PropertyList.java @@ -76,7 +76,7 @@ public abstract class PropertyList extends SimpleComponent { public Property(final String title, final String value) { super(); - Assert.assertNotNull(title, "String title"); + Assert.exists(title, "String title"); m_title = title; m_value = value; diff --git a/ccm-core/src/com/arsdigita/toolbox/ui/Section.java b/ccm-core/src/com/arsdigita/toolbox/ui/Section.java index 62016a84a..886712215 100755 --- a/ccm-core/src/com/arsdigita/toolbox/ui/Section.java +++ b/ccm-core/src/com/arsdigita/toolbox/ui/Section.java @@ -74,8 +74,8 @@ public class Section extends SimpleComponent { } public final void setHeading(final Component heading) { - Assert.assertNotNull(heading, "Component header"); - Assert.assertNotLocked(this); + Assert.exists(heading, "Component header"); + Assert.isUnlocked(this); m_heading = heading; } @@ -85,8 +85,8 @@ public class Section extends SimpleComponent { } public final void setBody(final Component body) { - Assert.assertNotNull(body, "Component body"); - Assert.assertNotLocked(this); + Assert.exists(body, "Component body"); + Assert.isUnlocked(this); m_body = body; } diff --git a/ccm-core/src/com/arsdigita/toolbox/ui/SelectionPanel.java b/ccm-core/src/com/arsdigita/toolbox/ui/SelectionPanel.java index 76b0210d7..15114eaf3 100755 --- a/ccm-core/src/com/arsdigita/toolbox/ui/SelectionPanel.java +++ b/ccm-core/src/com/arsdigita/toolbox/ui/SelectionPanel.java @@ -104,7 +104,7 @@ public class SelectionPanel extends LayoutPanel implements Resettable { if (Assert.isEnabled()) { Assert.exists(title, Component.class); Assert.exists(selector, Component.class); - Assert.truth(selector instanceof Tree || selector instanceof List); + Assert.isTrue(selector instanceof Tree || selector instanceof List); } // Making up now for some untoward modeling in Bebop. @@ -220,9 +220,9 @@ public class SelectionPanel extends LayoutPanel implements Resettable { public final void setAdd(final ActionLink addLink, final Form form) { - Assert.assertNotNull(addLink, "ActionLink addLink"); - Assert.assertNotNull(form, "Form form"); - Assert.assertNotLocked(this); + Assert.exists(addLink, "ActionLink addLink"); + Assert.exists(form, "Form form"); + Assert.isUnlocked(this); m_addForm = form; m_body.add(m_addForm); @@ -247,9 +247,9 @@ public class SelectionPanel extends LayoutPanel implements Resettable { public final void setEdit(final ActionLink editLink, final Form form) { - Assert.assertNotNull(editLink, "ActionLink editLink"); - Assert.assertNotNull(form, "Form form"); - Assert.assertNotLocked(this); + Assert.exists(editLink, "ActionLink editLink"); + Assert.exists(form, "Form form"); + Assert.isUnlocked(this); m_editForm = form; m_body.add(m_editForm); @@ -275,9 +275,9 @@ public class SelectionPanel extends LayoutPanel implements Resettable { public final void setDelete(final ActionLink deleteLink, final Form form) { - Assert.assertNotNull(deleteLink, "ActionLink deleteLink"); - Assert.assertNotNull(form, "Form form"); - Assert.assertNotLocked(this); + Assert.exists(deleteLink, "ActionLink deleteLink"); + Assert.exists(form, "Form form"); + Assert.isUnlocked(this); m_deleteForm = form; m_body.add(m_deleteForm); @@ -297,7 +297,7 @@ public class SelectionPanel extends LayoutPanel implements Resettable { public final void setIntroPane(final Component pane) { Assert.exists(pane, Component.class); - Assert.unlocked(this); + Assert.isUnlocked(this); m_introPane = pane; m_body.add(m_introPane); @@ -309,8 +309,8 @@ public class SelectionPanel extends LayoutPanel implements Resettable { } public final void setItemPane(final Component pane) { - Assert.assertNotNull(pane, "Component pane"); - Assert.assertNotLocked(this); + Assert.exists(pane, "Component pane"); + Assert.isUnlocked(this); m_itemPane = pane; m_body.add(m_itemPane); diff --git a/ccm-core/src/com/arsdigita/ui/SimplePageLayout.java b/ccm-core/src/com/arsdigita/ui/SimplePageLayout.java index 3a9253862..6627c58d8 100755 --- a/ccm-core/src/com/arsdigita/ui/SimplePageLayout.java +++ b/ccm-core/src/com/arsdigita/ui/SimplePageLayout.java @@ -56,7 +56,7 @@ class SimplePageLayout { Assert.exists(component, Class.class); Assert.exists(tag, String.class); - Assert.truth(SimpleComponent.class.isAssignableFrom(component), + Assert.isTrue(SimpleComponent.class.isAssignableFrom(component), "component is a subclass of SimpleComponent"); List list = (List)m_tags.get(tag); diff --git a/ccm-core/src/com/arsdigita/ui/admin/AdminSplitPanel.java b/ccm-core/src/com/arsdigita/ui/admin/AdminSplitPanel.java index a1fdd57fd..935f76146 100755 --- a/ccm-core/src/com/arsdigita/ui/admin/AdminSplitPanel.java +++ b/ccm-core/src/com/arsdigita/ui/admin/AdminSplitPanel.java @@ -67,7 +67,7 @@ class AdminSplitPanel extends BoxPanel implements ChangeListener { */ public void addTab (Label label, Component c) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); m_componentList.add(c); c.setClassAttr("main"); add(c); @@ -75,7 +75,7 @@ class AdminSplitPanel extends BoxPanel implements ChangeListener { } public void register(Page p) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); m_list = new List(new GlobalizedTabModelBuilder()); m_list.addChangeListener(this); diff --git a/ccm-core/src/com/arsdigita/ui/admin/UserNameLabel.java b/ccm-core/src/com/arsdigita/ui/admin/UserNameLabel.java index 95aa477bc..bb1980cbc 100755 --- a/ccm-core/src/com/arsdigita/ui/admin/UserNameLabel.java +++ b/ccm-core/src/com/arsdigita/ui/admin/UserNameLabel.java @@ -24,6 +24,7 @@ import com.arsdigita.bebop.event.PrintListener; import com.arsdigita.bebop.Label; import com.arsdigita.domain.DataObjectNotFoundException; import com.arsdigita.kernel.User; +// import com.arsdigita.ui.admin.AdminConstants; import java.math.BigDecimal; /** @@ -34,8 +35,6 @@ import java.math.BigDecimal; public class UserNameLabel extends Label { - public static final String versionId = "$Id: UserNameLabel.java 287 2005-02-22 00:29:02Z sskracic $ by $Author: sskracic $, $DateTime: 2004/08/16 18:10:38 $"; - public UserNameLabel() { super(); @@ -48,7 +47,9 @@ public class UserNameLabel extends Label { User user; try { + // Deprecated, use getValue instead BigDecimal id = (BigDecimal) s.getGlobalValue("user_id"); +// BigDecimal id = (BigDecimal) s.getValue(USER_ID_PARAM); user = User.retrieve(id); t.setLabel(user.getName()); } catch (DataObjectNotFoundException ex) { diff --git a/ccm-core/src/com/arsdigita/util/Assert.java b/ccm-core/src/com/arsdigita/util/Assert.java index fee0fd663..464aaa629 100755 --- a/ccm-core/src/com/arsdigita/util/Assert.java +++ b/ccm-core/src/com/arsdigita/util/Assert.java @@ -36,14 +36,10 @@ import org.apache.log4j.Logger; * @version $Id: Assert.java 287 2005-02-22 00:29:02Z sskracic $ */ public class Assert { - public static final String versionId = - "$Id: Assert.java 287 2005-02-22 00:29:02Z sskracic $" + - "$Author: sskracic $" + - "$DateTime: 2004/08/16 18:10:38 $"; - - private static final Logger s_log = Logger.getLogger - (Assert.class); + /** Class specific logger instance. */ + private static final Logger s_log = Logger.getLogger(Assert.class); + private static final String DEFAULT_MESSAGE = "Assertion failure"; /** @@ -131,29 +127,6 @@ public class Assert { } } - /** - * Asserts that an arbitrary condition is true and throws an - * error with message message if the condition is - * false. - * - * @param condition The condition asserted - * @param message An error message - * @throws AssertionError if the condition is false - * @deprecated use Assert.isTrue(condition, message) instead - * (we will follow the standard naming scheme) - */ - public static final void truth(final boolean condition, - final String message) { - Assert.isTrue(condition, message); - - - // if (!condition) { - // error(message); - // - // throw new AssertionError(message); - // } - } - /** * Asserts that an arbitrary condition is true and throws an * error with message message if the condition is @@ -170,26 +143,6 @@ public class Assert { } } - /** - * Asserts that an arbitrary condition is true and throws an - * error with message message if the condition is - * false. - * - * @param condition The condition asserted - * @throws AssertionError if the condition is false - * @deprecated use Assert.isTrue(final boolean condition) instead - * (we will follow the standard naming scheme) - */ - public static final void truth(final boolean condition) { - Assert.isTrue(condition); - - // if (!condition) { - // error(DEFAULT_MESSAGE); - // - // throw new AssertionError(DEFAULT_MESSAGE); - // } - } - /** * Asserts that an arbitrary condition is false and throws an * error if the condition is true. @@ -198,7 +151,7 @@ public class Assert { * @param message An error message * @throws AssertionError if the condition is false */ - public static final void falsity(final boolean condition, + public static final void isFalse(final boolean condition, final String message) { if (condition) { error(message); @@ -214,7 +167,7 @@ public class Assert { * @param condition The condition asserted * @throws AssertionError if the condition is false */ - public static final void falsity(final boolean condition) { + public static final void isFalse(final boolean condition) { if (condition) { error(DEFAULT_MESSAGE); @@ -284,9 +237,10 @@ public class Assert { * @param lockable The object that must be locked * @see com.arsdigita.util.Lockable */ - public static final void locked(final Lockable lockable) { + public static final void isLocked(final Lockable lockable) { if (lockable != null && !lockable.isLocked()) { - final String message = lockable + " is not locked"; + final String message = "Illegal access: " + lockable + + " is not locked"; error(message); @@ -298,12 +252,12 @@ public class Assert { * Verifies that lockable is not locked and * throws an error if it is. * - * @param lockable The object that must not be locked + * @param lockable The object that must not be isLocked * @see com.arsdigita.util.Lockable */ - public static final void unlocked(final Lockable lockable) { + public static final void isUnlocked(final Lockable lockable) { if (lockable != null && lockable.isLocked()) { - final String message = lockable + " is locked"; + final String message = "Illegal access: " + lockable + " is locked."; error(message); @@ -312,15 +266,15 @@ public class Assert { } /** - * Verifies that two values are equal (according to their equals + * Verifies that two values are isEqual (according to their equals * method, unless value1 is null, then according to * ==). * * @param value1 The first value to be compared * @param value2 The second - * @throws AssertionError if the arguments are unequal + * @throws AssertionError if the arguments are isNotEqual */ - public static final void equal(final Object value1, + public static final void isEqual(final Object value1, final Object value2) { if (value1 == null) { if (value1 != value2) { @@ -342,15 +296,15 @@ public class Assert { } /** - * Verifies that two values are equal (according to their equals + * Verifies that two values are isEqual (according to their equals * method, unless value1 is null, then according to * ==). * * @param value1 The first value to be compared * @param value2 The second - * @throws AssertionError if the arguments are unequal + * @throws AssertionError if the arguments are isNotEqual */ - public static final void equal(final Object value1, + public static final void isEqual(final Object value1, final Object value2, final String message) { if (value1 == null) { @@ -369,15 +323,15 @@ public class Assert { } /** - * Verifies that two values are not equal (according to their + * Verifies that two values are not isEqual (according to their * equals method, unless value1 is null, then * according to ==). * * @param value1 The first value to be compared * @param value2 The second - * @throws AssertionError if the arguments are unequal + * @throws AssertionError if the arguments are isNotEqual */ - public static final void unequal(final Object value1, + public static final void isNotEqual(final Object value1, final Object value2) { if (value1 == null) { if (value1 == value2) { @@ -397,6 +351,14 @@ public class Assert { } } } + + // Utility methods + + private static void error(final String message) { + // Log the stack trace too, since we still have code that + // manages to hide exceptions. + s_log.error(message, new AssertionError(message)); + } /////////////////////////////////////////////////////////////////////////// // // @@ -422,15 +384,15 @@ public class Assert { // return isEnabled(); // } - /** - * Tells whether asserts are turned on. Use this to wrap code - * that should be optimized away if asserts are disabled. - * - * @deprecated Use {@link #isEnabled()} instead - */ - public static final boolean isAssertEnabled() { - return isEnabled(); - } +// /** +// * Tells whether asserts are turned on. Use this to wrap code +// * that should be optimized away if asserts are disabled. +// * +// * @deprecated Use {@link #isEnabled()} instead +// */ +// public static final boolean isAssertEnabled() { +// return isEnabled(); +// } /** * Assert that an arbitrary condition is true, and throw an @@ -440,10 +402,10 @@ public class Assert { * @throws java.lang.IllegalStateException condition was false * @deprecated Use {@link #truth(boolean, String)} instead */ - public static final void assertTrue(boolean cond) { - assertTrue(cond, ""); +/* public static final void isTrue(boolean cond) { + isTrue(cond, ""); } - +*/ /** * Assert that an arbitrary condition is true, and throw an * exception with message msg if the condition is @@ -454,46 +416,124 @@ public class Assert { * @throws java.lang.IllegalStateException condition was false * @deprecated Use {@link #truth(boolean,String)} instead */ - public static final void assertTrue(boolean cond, String msg) { +/* public static final void assertTrue(boolean cond, String msg) { if (!cond) { error(msg); throw new IllegalStateException(msg); } } +*/ + /** + * Asserts that an arbitrary condition is true and throws an + * error with message message if the condition is + * false. + * + * @param condition The condition asserted + * @param message An error message + * @throws AssertionError if the condition is false + * @deprecated use Assert.isTrue(condition, message) instead + * (we will follow the standard naming scheme) + */ +/* public static final void truth(final boolean condition, + final String message) { + Assert.isTrue(condition, message); + + // if (!condition) { + // error(message); + // + // throw new AssertionError(message); + // } + } +*/ + + /** + * Asserts that an arbitrary condition is true and throws an + * error with message message if the condition is + * false. + * + * @param condition The condition asserted + * @throws AssertionError if the condition is false + * @deprecated use Assert.isTrue(final boolean condition) instead + * (we will follow the standard naming scheme) + */ +/* public static final void truth(final boolean condition) { + Assert.isTrue(condition); + + // if (!condition) { + // error(DEFAULT_MESSAGE); + // + // throw new AssertionError(DEFAULT_MESSAGE); + // } + } +*/ + + /** + * Asserts that an arbitrary condition is false and throws an + * error if the condition is true. + * + * @param condition The condition asserted + * @param message An error message + * @throws AssertionError if the condition is false + */ +/* public static final void falsity(final boolean condition, + final String message) { + if (condition) { + error(message); + + throw new AssertionError(message); + } + } +*/ + + /** + * Asserts that an arbitrary condition is false and throws an + * error if the condition is true. + * + * @param condition The condition asserted + * @throws AssertionError if the condition is false + */ +/* public static final void falsity(final boolean condition) { + if (condition) { + error(DEFAULT_MESSAGE); + + throw new AssertionError(DEFAULT_MESSAGE); + } + } +*/ /** * Verify that a parameter is not null and throw a runtime * exception if so. * * @deprecated Use {@link #exists(Object)} instead */ - public static final void assertNotNull(Object o) { +/* public static final void assertNotNull(Object o) { assertNotNull(o, ""); } - +*/ /** * Verify that a parameter is not null and throw a runtime * exception if so. * * @deprecated Use {@link #exists(Object,String)} instead */ - public static final void assertNotNull(Object o, String label) { +/* public static final void assertNotNull(Object o, String label) { if (isEnabled()) { - assertTrue(o != null, "Value of " + label + " is null."); + isTrue(o != null, "Value of " + label + " is null."); } } - - /** - * Verify that a string is not empty and throw a runtime exception - * if so. A parameter is considered empty if it is null, or if it - * does not contain any characters that are non-whitespace. - * - * @deprecated with no replacement - */ - public static final void assertNotEmpty(String s) { - assertNotEmpty(s, ""); - } +*/ +// /** +// * Verify that a string is not empty and throw a runtime exception +// * if so. A parameter is considered empty if it is null, or if it +// * does not contain any characters that are non-whitespace. +// * +// * @deprecated with no replacement +// */ +// public static final void assertNotEmpty(String s) { +// assertNotEmpty(s, ""); +// } /** * Verify that a string is not empty and throw a runtime exception @@ -504,26 +544,26 @@ public class Assert { */ public static final void assertNotEmpty(String s, String label) { if (isEnabled()) { - assertTrue(s != null && s.trim().length() > 0, + isTrue(s != null && s.trim().length() > 0, "Value of " + label + " is empty."); } } /** - * Verify that two values are equal (according to their equals method, + * Verify that two values are isEqual (according to their equals method, * unless expected is null, then according to ==). * * @param expected Expected value. * @param actual Actual value. * @throws java.lang.IllegalStateException condition was false - * @deprecated Use {@link #equal(Object,Object)} instead + * @deprecated Use {@link #isEqual(Object,Object)} instead */ public static final void assertEquals(Object expected, Object actual) { assertEquals(expected, actual, "expected", "actual"); } /** - * Verify that two values are equal (according to their equals method, + * Verify that two values are isEqual (according to their equals method, * unless expected is null, then according to ==). * * @param expected Expected value. @@ -537,12 +577,12 @@ public class Assert { String actualLabel) { if (isEnabled()) { if (expected == null) { - assertTrue(expected == actual, + isTrue(expected == actual, "Values not equal, " + expectedLabel + " '" + expected + "', " + actualLabel + " '" + actual + "'"); } else { - assertTrue(expected.equals(actual), + isTrue(expected.equals(actual), "Values not equal, " + expectedLabel + " '" + expected + "', " + actualLabel + " '" + actual + "'"); @@ -551,7 +591,7 @@ public class Assert { } /** - * Verify that two values are equal. + * Verify that two values are isEqual. * * @param expected Expected value. * @param actual Actual value. @@ -563,7 +603,7 @@ public class Assert { } /** - * Verify that two values are equal. + * Verify that two values are isEqual. * * @param expected Expected value. * @param actual Actual value. @@ -576,7 +616,7 @@ public class Assert { String expectedLabel, String actualLabel) { if (isEnabled()) { - assertTrue(expected == actual, + isTrue(expected == actual, "Values not equal, " + expectedLabel + " '" + expected + "', " + actualLabel + " '" + actual + "'"); @@ -587,35 +627,48 @@ public class Assert { * Verify that the model is locked and throw a runtime exception * if it is not locked. * - * @deprecated Use {@link #locked(Lockable)} instead + * @deprecated Use {@link #isLocked(Lockable)} instead */ - public static void assertLocked(Lockable l) { +/* public static void assertLocked(Lockable l) { if (isEnabled()) { - assertTrue(l.isLocked(), + isTrue(l.isLocked(), "Illegal access to an unlocked " + l.getClass().getName()); } } - +*/ /** - * Verify that the model is locked and throw a runtime exception - * if it is locked. + * Verify that the model is isLocked and throw a runtime exception + * if it is isLocked. * - * @deprecated Use {@link #unlocked(Lockable)} instead +// * @deprecated Use {@link #isUnlocked(Lockable)} instead */ - public static void assertNotLocked(Lockable l) { +/* public static void assertUnlocked(Lockable l) { if (isEnabled()) { - assertTrue(!l.isLocked(), - "Illegal access to a locked " + + isTrue(!l.isLocked(), + "Illegal access to a isLocked " + l.getClass().getName()); } } +*/ + /** + * Verifies that lockable is not isLocked and + * throws an error if it is. + * + * @param lockable The object that must not be isLocked + * @see com.arsdigita.util.Lockable +// * @deprecated use isUnlocked(Lockable) instead + */ +/* public static final void unlocked(final Lockable lockable) { + if (lockable != null && lockable.isLocked()) { + final String message = "Illegal access: " + lockable + " is isLocked."; - // Utility methods + error(message); - private static void error(final String message) { - // Log the stack trace too, since we still have code that - // manages to hide exceptions. - s_log.error(message, new AssertionError(message)); + throw new AssertionError(message); + } } +*/ + + } diff --git a/ccm-core/src/com/arsdigita/util/CallTracer.java b/ccm-core/src/com/arsdigita/util/CallTracer.java index 381f2796d..e328885bd 100755 --- a/ccm-core/src/com/arsdigita/util/CallTracer.java +++ b/ccm-core/src/com/arsdigita/util/CallTracer.java @@ -155,7 +155,7 @@ public class CallTracer { * @return The file listing where the method was called from */ public static String getCaller(final int level) { - Assert.truth(level > 0, "Level must be greater than zero!"); + Assert.isTrue(level > 0, "Level must be greater than zero!"); final List trace = StringUtils.getStackList(new Throwable()); return getCallerFromTrace(level, trace); } diff --git a/ccm-core/src/com/arsdigita/util/Files.java b/ccm-core/src/com/arsdigita/util/Files.java index 52b3c8531..f8525caff 100755 --- a/ccm-core/src/com/arsdigita/util/Files.java +++ b/ccm-core/src/com/arsdigita/util/Files.java @@ -253,7 +253,7 @@ public final class Files { Collection files, String prefix) { // TODO: there has to be a better way to do this... - Assert.truth(baseDirectory.isDirectory(), + Assert.isTrue(baseDirectory.isDirectory(), "Base Directory must be a directory but is actually a file."); if (prefix != null && prefix.trim().length() == 0) { prefix = null; diff --git a/ccm-core/src/com/arsdigita/util/GraphSet.java b/ccm-core/src/com/arsdigita/util/GraphSet.java index 53d899cdd..c3645987e 100755 --- a/ccm-core/src/com/arsdigita/util/GraphSet.java +++ b/ccm-core/src/com/arsdigita/util/GraphSet.java @@ -67,7 +67,7 @@ public class GraphSet implements Graph { } public void setLabel(String label) { - Assert.assertTrue(label !=null, "label is not null"); + Assert.isTrue(label !=null, "label is not null"); m_label = label; } @@ -161,17 +161,17 @@ public class GraphSet implements Graph { } public List getOutgoingEdges(Object node) { - Assert.assertTrue(hasNode(node), objToString(node)); + Assert.isTrue(hasNode(node), objToString(node)); return new ArrayList(outgoingEdges(node)); } public int outgoingEdgeCount(Object node) { - Assert.assertTrue(hasNode(node), objToString(node)); + Assert.isTrue(hasNode(node), objToString(node)); return outgoingEdges(node).size(); } public int incomingEdgeCount(Object node) { - Assert.assertTrue(hasNode(node), objToString(node)); + Assert.isTrue(hasNode(node), objToString(node)); return incomingEdges(node).size(); } @@ -185,7 +185,7 @@ public class GraphSet implements Graph { } public List getIncomingEdges(Object node) { - Assert.assertTrue(hasNode(node), objToString(node)); + Assert.isTrue(hasNode(node), objToString(node)); return new ArrayList(incomingEdges(node)); } diff --git a/ccm-core/src/com/arsdigita/util/Graphs.java b/ccm-core/src/com/arsdigita/util/Graphs.java index ecd9606e2..b0fbee92f 100755 --- a/ccm-core/src/com/arsdigita/util/Graphs.java +++ b/ccm-core/src/com/arsdigita/util/Graphs.java @@ -157,7 +157,7 @@ public class Graphs { * @pre graph.hasNode(start) **/ public static Graph nodesReachableFrom(Graph graph, Object start) { - Assert.assertTrue(graph.hasNode(start)); + Assert.isTrue(graph.hasNode(start)); Graph result = new GraphSet(); result.addNode(start); Set processedTails = new HashSet(); @@ -208,9 +208,9 @@ public class Graphs { public static void printTree(Tree tree, GraphFormatter fmtr, PrintWriter writer) { - Assert.assertNotNull(tree, "tree"); - Assert.assertNotNull(fmtr, "formatter"); - Assert.assertNotNull(writer, "writer"); + Assert.exists(tree, "tree"); + Assert.exists(fmtr, "formatter"); + Assert.exists(writer, "writer"); writer.println("digraph " + tree.getLabel() + " {"); printTreeRecurse(tree, fmtr, writer); @@ -245,9 +245,9 @@ public class Graphs { public static void printGraph(Graph graph, GraphFormatter fmtr, PrintWriter writer) { - Assert.assertNotNull(graph, "tree"); - Assert.assertNotNull(fmtr, "formatter"); - Assert.assertNotNull(writer, "writer"); + Assert.exists(graph, "tree"); + Assert.exists(fmtr, "formatter"); + Assert.exists(writer, "writer"); writer.println("digraph " + graph.getLabel() + " {"); String graphAttrs = fmtr.graphAttributes(graph); diff --git a/ccm-core/src/com/arsdigita/util/OrderedMap.java b/ccm-core/src/com/arsdigita/util/OrderedMap.java index 12dd89154..304ed0046 100755 --- a/ccm-core/src/com/arsdigita/util/OrderedMap.java +++ b/ccm-core/src/com/arsdigita/util/OrderedMap.java @@ -112,7 +112,7 @@ final class OrderingComparator implements Comparator, Cloneable { } if (Assert.isEnabled() && result == 0) { - Assert.truth(o1.equals(o2)); + Assert.isTrue(o1.equals(o2)); } return result; diff --git a/ccm-core/src/com/arsdigita/util/StringUtils.java b/ccm-core/src/com/arsdigita/util/StringUtils.java index 852e71d0a..d00dffe74 100755 --- a/ccm-core/src/com/arsdigita/util/StringUtils.java +++ b/ccm-core/src/com/arsdigita/util/StringUtils.java @@ -674,7 +674,7 @@ public class StringUtils { /** * Strip extra white space from a string. This replaces any white space * character or consecutive white space characters with a single space. - * It is useful when comparing strings that should be equal except for + * It is useful when comparing strings that should be isEqual except for * possible differences in white space. Example: input = "I \ndo\tsee". * Output = "I do see". * @param s string that may contain extra white space diff --git a/ccm-core/src/com/arsdigita/util/Tree.java b/ccm-core/src/com/arsdigita/util/Tree.java index 9082ef002..d38d3ca5a 100755 --- a/ccm-core/src/com/arsdigita/util/Tree.java +++ b/ccm-core/src/com/arsdigita/util/Tree.java @@ -128,8 +128,8 @@ public class Tree { * @pre subtree != null && subtree.getParent() == 0 **/ public void addSubtree(Tree subtree, Object edge) { - Assert.assertNotNull(subtree, "subtree"); - Assert.assertTrue(subtree.getParent() == null, "parent must be null"); + Assert.exists(subtree, "subtree"); + Assert.isTrue(subtree.getParent() == null, "parent must be null"); subtree.m_parent = this; m_children.add(new EdgeTreePair(edge, subtree)); } @@ -248,7 +248,7 @@ public class Tree { * @pre trees != null **/ public static List treesToNodes(List trees) { - Assert.assertNotNull(trees, "trees"); + Assert.exists(trees, "trees"); List result = new ArrayList(); for (Iterator ii=trees.iterator(); ii.hasNext(); ) { result.add(((Tree) ii.next()).getRoot()); diff --git a/ccm-core/src/com/arsdigita/util/servlet/HttpHost.java b/ccm-core/src/com/arsdigita/util/servlet/HttpHost.java index 0fd393110..45f7129b0 100755 --- a/ccm-core/src/com/arsdigita/util/servlet/HttpHost.java +++ b/ccm-core/src/com/arsdigita/util/servlet/HttpHost.java @@ -57,7 +57,7 @@ public class HttpHost { public HttpHost(final String name, final int port) { if (Assert.isEnabled()) { Assert.exists(name, String.class); - Assert.truth(port > 0, + Assert.isTrue(port > 0, "The port must be greater than 0; " + "I got " + port); } diff --git a/ccm-core/src/com/arsdigita/util/servlet/HttpParameterMap.java b/ccm-core/src/com/arsdigita/util/servlet/HttpParameterMap.java index dc4bfd6a4..705afffc7 100755 --- a/ccm-core/src/com/arsdigita/util/servlet/HttpParameterMap.java +++ b/ccm-core/src/com/arsdigita/util/servlet/HttpParameterMap.java @@ -94,9 +94,9 @@ public class HttpParameterMap { private void validateName(final String name) { Assert.exists(name, String.class); - Assert.truth(!name.equals(""), + Assert.isTrue(!name.equals(""), "The name must not be the empty string"); - Assert.truth(name.indexOf(" ") == -1, + Assert.isTrue(name.indexOf(" ") == -1, "The name must not contain any spaces: '" + name + "'"); } @@ -168,8 +168,8 @@ public class HttpParameterMap { final String[] values) { if (Assert.isEnabled()) { validateName(name); - Assert.assertNotNull(values, "String[] values"); - Assert.assertTrue(values.length > 0, + Assert.exists(values, "String[] values"); + Assert.isTrue(values.length > 0, "The values array must have at least one value"); } @@ -229,14 +229,14 @@ public class HttpParameterMap { final String[] values = (String[]) entry.getValue(); if (Assert.isEnabled()) { - Assert.truth(key.indexOf('%') == -1, + Assert.isTrue(key.indexOf('%') == -1, "The key '" + key + "' has already been " + "encoded"); } if (values != null) { if (Assert.isEnabled()) { - Assert.truth(values.toString().indexOf('%') == -1, + Assert.isTrue(values.toString().indexOf('%') == -1, "One of the values " + Arrays.asList(values) + " has " + "already been encoded"); @@ -297,9 +297,9 @@ public class HttpParameterMap { final int end) { final int sep = query.indexOf('=', start); - if (Assert.isAssertEnabled()) { - Assert.assertTrue(start > -1); - Assert.assertTrue(end > -1); + if (Assert.isEnabled()) { + Assert.isTrue(start > -1); + Assert.isTrue(end > -1); } if (sep > -1) { diff --git a/ccm-core/src/com/arsdigita/util/url/URLCache.java b/ccm-core/src/com/arsdigita/util/url/URLCache.java index 45eb9a166..d669c7926 100755 --- a/ccm-core/src/com/arsdigita/util/url/URLCache.java +++ b/ccm-core/src/com/arsdigita/util/url/URLCache.java @@ -269,7 +269,7 @@ public class URLCache { private synchronized void addToCache(String url, URLData data, long expiry) { final long dataSize = data.getContent().length + url.length(); - Assert.assertTrue(m_curSize + dataSize <= m_maxSize); + Assert.isTrue(m_curSize + dataSize <= m_maxSize); Entry e = new Entry(data, System.currentTimeMillis(), expiry); m_cache.put(url, e); m_curSize += dataSize; diff --git a/ccm-core/src/com/arsdigita/util/url/URLData.java b/ccm-core/src/com/arsdigita/util/url/URLData.java index 6f4e31a85..c92894067 100755 --- a/ccm-core/src/com/arsdigita/util/url/URLData.java +++ b/ccm-core/src/com/arsdigita/util/url/URLData.java @@ -60,7 +60,7 @@ public class URLData { * @pre url != null */ public URLData(String url, Map headers, byte[] content) { - Assert.assertNotNull(url); + Assert.exists(url); m_url = null; setHeaders(headers); setContent(content); diff --git a/ccm-core/src/com/arsdigita/util/url/URLFetcher.java b/ccm-core/src/com/arsdigita/util/url/URLFetcher.java index 137cfd192..cba9e8e1d 100755 --- a/ccm-core/src/com/arsdigita/util/url/URLFetcher.java +++ b/ccm-core/src/com/arsdigita/util/url/URLFetcher.java @@ -68,7 +68,7 @@ public class URLFetcher { */ public static void registerService(String key, URLPool pool, URLCache cache, boolean cacheFailedRetrievals) { - Assert.assertTrue(!StringUtils.emptyString(key), "Key must not be empty!"); + Assert.isTrue(!StringUtils.emptyString(key), "Key must not be empty!"); CacheService cs = new CacheService(pool, cache, cacheFailedRetrievals); s_services.put(key, cs); }; @@ -95,7 +95,7 @@ public class URLFetcher { * the cache.Returns the data for the page, or null if the fetch failed. */ public static URLData fetchURLData(String url, String key) { - Assert.assertTrue(!StringUtils.emptyString(url), + Assert.isTrue(!StringUtils.emptyString(url), "URL must not be empty!"); CacheService cs = getService(key); @@ -122,7 +122,7 @@ public class URLFetcher { * Purges the specified URL from the cache. */ public static void purgeURL(String url, String key) { - Assert.assertTrue(!StringUtils.emptyString(url), "URL must not be null!"); + Assert.isTrue(!StringUtils.emptyString(url), "URL must not be null!"); CacheService cs = getService(key); cs.cache.purge(url); }; @@ -132,7 +132,7 @@ public class URLFetcher { } private static CacheService getService(String key) { - Assert.assertTrue(!StringUtils.emptyString(key), "Key must not be empty!"); + Assert.isTrue(!StringUtils.emptyString(key), "Key must not be empty!"); CacheService cs = (CacheService) s_services.get(key); return cs; } @@ -145,8 +145,8 @@ public class URLFetcher { final boolean cacheFailedRetrievals; CacheService (URLPool pool, URLCache cache, boolean cacheFailedRetrievals) { - Assert.assertNotNull(pool, "URLPool cannot be null!"); - Assert.assertNotNull(cache, "URLCache cannot be null!"); + Assert.exists(pool, "URLPool cannot be null!"); + Assert.exists(cache, "URLCache cannot be null!"); this.pool = pool; this.cache = cache; diff --git a/ccm-core/src/com/arsdigita/versioning/Adapter.java b/ccm-core/src/com/arsdigita/versioning/Adapter.java index df349593a..92723bb48 100755 --- a/ccm-core/src/com/arsdigita/versioning/Adapter.java +++ b/ccm-core/src/com/arsdigita/versioning/Adapter.java @@ -106,7 +106,7 @@ final class Adapter { }); s_converters.put(Types.CHARACTER, new SimpleConverter() { public Object deserialize(String str) { - Assert.truth(str.length() == 1, "str.length() == 1"); + Assert.isTrue(str.length() == 1, "str.length() == 1"); return new Character(str.charAt(0)); } }); @@ -122,7 +122,7 @@ final class Adapter { public Object deserialize(String str) { int idx = str.indexOf(s_dateDelim); - Assert.truth(idx>=0, "idx>0"); + Assert.isTrue(idx>=0, "idx>0"); return new Date(Long.parseLong(str.substring(0, idx))); } }); @@ -180,10 +180,10 @@ final class Adapter { public Object deserialize(String str) { int mIdx = str.indexOf(s_tstampDelim); - Assert.truth(mIdx>=0, "mIdx>0"); + Assert.isTrue(mIdx>=0, "mIdx>0"); long millis = Long.parseLong(str.substring(0, mIdx)); int nIdx = str.indexOf(s_dateDelim, mIdx); - Assert.truth(nIdx>=0, "nIdx>0"); + Assert.isTrue(nIdx>=0, "nIdx>0"); int nanos = Integer.parseInt(str.substring(mIdx+1, nIdx)); Timestamp result = new Timestamp(millis); result.setNanos(nanos); @@ -221,7 +221,7 @@ final class Adapter { keyValuePairs.add(packed.toString()); } - Assert.truth(keyValuePairs.size()>0, + Assert.isTrue(keyValuePairs.size()>0, "oid has at least one property"); if ( keyValuePairs.size() > 1 ) Collections.sort(keyValuePairs); @@ -237,18 +237,18 @@ final class Adapter { private static OID deserializeOID(String str) { final StringTokenizer st = new StringTokenizer(str, s_oidDelim); - Assert.truth(st.hasMoreTokens(), str); + Assert.isTrue(st.hasMoreTokens(), str); OID oid = new OID(st.nextToken()); while (st.hasMoreTokens() ) { final String token = st.nextToken(); final StringTokenizer tuple = new StringTokenizer(token, ":"); - Assert.truth(tuple.hasMoreTokens(), token); + Assert.isTrue(tuple.hasMoreTokens(), token); String pName = tuple.nextToken(); - Assert.truth(tuple.hasMoreTokens(), token); + Assert.isTrue(tuple.hasMoreTokens(), token); String pType = tuple.nextToken(); - Assert.truth(tuple.hasMoreTokens(), token); + Assert.isTrue(tuple.hasMoreTokens(), token); String pValue = token.substring(pName.length() + pType.length() + 2); oid.set(pName, deserialize(pValue, Types.getType(new BigInteger(pType)))); diff --git a/ccm-core/src/com/arsdigita/versioning/DataObjectDiff.java b/ccm-core/src/com/arsdigita/versioning/DataObjectDiff.java index c56a2668d..7f6d6a727 100755 --- a/ccm-core/src/com/arsdigita/versioning/DataObjectDiff.java +++ b/ccm-core/src/com/arsdigita/versioning/DataObjectDiff.java @@ -324,7 +324,7 @@ final class DataObjectDiff implements Constants { private void createDataObject() { m_listener.onCreate(getOID()); m_dataObject = SessionManager.getSession().create(getOID()); - Assert.truth(m_dataObject.isNew(), getOID() + " is new"); + Assert.isTrue(m_dataObject.isNew(), getOID() + " is new"); } /** @@ -694,7 +694,7 @@ final class DataObjectDiff implements Constants { } public void add(Attribute attr) throws CollectionAttributeException { - Assert.truth(attr.isCompound(), "attr.isCompound(): " + attr); + Assert.isTrue(attr.isCompound(), "attr.isCompound(): " + attr); OID oid = (OID) attr.getValue(); if ( m_added.containsKey(oid) ) { throw new CollectionAttributeException(attr); @@ -712,7 +712,7 @@ final class DataObjectDiff implements Constants { } public void remove(Attribute attr) throws CollectionAttributeException { - Assert.truth(attr.isCompound(), "attr.isCompound(): " + attr); + Assert.isTrue(attr.isCompound(), "attr.isCompound(): " + attr); OID oid = (OID) attr.getValue(); if ( m_removed.containsKey(oid) ) { throw new CollectionAttributeException(attr); diff --git a/ccm-core/src/com/arsdigita/versioning/EdgeLabel.java b/ccm-core/src/com/arsdigita/versioning/EdgeLabel.java index e15c533e5..3f099cd8e 100755 --- a/ccm-core/src/com/arsdigita/versioning/EdgeLabel.java +++ b/ccm-core/src/com/arsdigita/versioning/EdgeLabel.java @@ -61,7 +61,7 @@ final class EdgeLabel { * @post isVersioned() **/ public void setVersioned() { - Assert.truth(m_state == UNMARKED, "is unmarked"); + Assert.isTrue(m_state == UNMARKED, "is unmarked"); m_state = VERSIONED; } @@ -73,7 +73,7 @@ final class EdgeLabel { * @post isUnversioned() **/ public void setUnversioned() { - Assert.truth(m_state == UNMARKED, "is unmarked"); + Assert.isTrue(m_state == UNMARKED, "is unmarked"); m_state = UNVERSIONED; } diff --git a/ccm-core/src/com/arsdigita/versioning/EventType.java b/ccm-core/src/com/arsdigita/versioning/EventType.java index 9356e8bf2..2f375a0eb 100755 --- a/ccm-core/src/com/arsdigita/versioning/EventType.java +++ b/ccm-core/src/com/arsdigita/versioning/EventType.java @@ -105,7 +105,7 @@ final class EventType { static EventType getEventType(DataObject ev) { BigInteger id = (BigInteger) ev.get("id"); - Assert.truth(s_types.containsKey(id), "s_types.contains(id)"); + Assert.isTrue(s_types.containsKey(id), "s_types.contains(id)"); return (EventType) s_types.get(id); } diff --git a/ccm-core/src/com/arsdigita/versioning/ObjectTypeMetadata.java b/ccm-core/src/com/arsdigita/versioning/ObjectTypeMetadata.java index b9b721dbd..35acf6cd6 100755 --- a/ccm-core/src/com/arsdigita/versioning/ObjectTypeMetadata.java +++ b/ccm-core/src/com/arsdigita/versioning/ObjectTypeMetadata.java @@ -326,7 +326,7 @@ final class ObjectTypeMetadata { } GraphNode node = GraphNode.getInstance((ObjectType) prop.getContainer()); - Assert.truth(m_dependenceGraph.hasNode(node), + Assert.isTrue(m_dependenceGraph.hasNode(node), "dependence graph has " + prop.getContainer()); Graph.Edge edge = getPropertyEdge(node, prop); @@ -342,7 +342,7 @@ final class ObjectTypeMetadata { synchronized void addVersionedProperty(Property prop) { Assert.exists(prop, Property.class); m_versionedProperties.add(prop); - Assert.falsity(prop.getType().isSimple(), "property is simple: " + prop); + Assert.isFalse(prop.getType().isSimple(), "property is simple: " + prop); GraphNode tail = GraphNode.getInstance((ObjectType) prop.getContainer()); diff --git a/ccm-core/src/com/arsdigita/versioning/VersionController.java b/ccm-core/src/com/arsdigita/versioning/VersionController.java index e4314346d..2a357c00f 100755 --- a/ccm-core/src/com/arsdigita/versioning/VersionController.java +++ b/ccm-core/src/com/arsdigita/versioning/VersionController.java @@ -57,7 +57,7 @@ class VersionController { */ protected static void autoPropagateMaster (VersionedACSObject obj, VersionedACSObject master) { - Assert.assertTrue + Assert.isTrue (master.isMaster(), "Object " + master.getOID() + " is the master object"); diff --git a/ccm-core/src/com/arsdigita/versioning/VersionedACSObject.java b/ccm-core/src/com/arsdigita/versioning/VersionedACSObject.java index 375a48979..f2a368c5b 100755 --- a/ccm-core/src/com/arsdigita/versioning/VersionedACSObject.java +++ b/ccm-core/src/com/arsdigita/versioning/VersionedACSObject.java @@ -216,10 +216,10 @@ public class VersionedACSObject extends ACSObject implements Audited { * @deprecated */ public void setMaster(VersionedACSObject master) { - Assert.assertNotNull(master, "master object"); - Assert.assertTrue + Assert.exists(master, "master object"); + Assert.isTrue (!isRolledBack(), "Object " + getID() + " is rolled back"); - Assert.assertTrue + Assert.isTrue (!master.isRolledBack(), "Master Object " + master.getID() + " is rolled back"); @@ -334,7 +334,7 @@ public class VersionedACSObject extends ACSObject implements Audited { if (s_properType == null) { s_properType = SessionManager.getSession().getMetadataRoot(). getObjectType(BASE_DATA_OBJECT_TYPE); - Assert.assertNotNull + Assert.exists (s_properType, "Object type " + BASE_DATA_OBJECT_TYPE); } return subType.isSubtypeOf(s_properType); diff --git a/ccm-core/src/com/arsdigita/web/Application.java b/ccm-core/src/com/arsdigita/web/Application.java index 6399b0ec7..a6f78e417 100755 --- a/ccm-core/src/com/arsdigita/web/Application.java +++ b/ccm-core/src/com/arsdigita/web/Application.java @@ -665,7 +665,7 @@ public class Application extends Resource { * */ public void createGroup() { - Assert.equal(getGroup(), null, + Assert.isEqual(getGroup(), null, "Group has already been created for Application " + getTitle()); Group group = new Group(); diff --git a/ccm-core/src/com/arsdigita/web/ApplicationCollection.java b/ccm-core/src/com/arsdigita/web/ApplicationCollection.java index 4baaa5c3a..3f08a319f 100755 --- a/ccm-core/src/com/arsdigita/web/ApplicationCollection.java +++ b/ccm-core/src/com/arsdigita/web/ApplicationCollection.java @@ -99,7 +99,7 @@ public class ApplicationCollection extends ACSObjectCollection { Application application = Application.retrieveApplication(dataObject); - Assert.assertNotNull(application, "application"); + Assert.exists(application, "application"); return application; } @@ -113,7 +113,7 @@ public class ApplicationCollection extends ACSObjectCollection { public String getTitle() { String title = (String)m_dataCollection.get("title"); - Assert.assertNotNull(title, "title"); + Assert.exists(title, "title"); return title; } @@ -140,7 +140,7 @@ public class ApplicationCollection extends ACSObjectCollection { public String getPrimaryURL() { String primaryURL = (String)m_dataCollection.get("primaryURL"); - Assert.assertNotNull(primaryURL, "primaryURL"); + Assert.exists(primaryURL, "primaryURL"); return primaryURL; } diff --git a/ccm-core/src/com/arsdigita/web/ApplicationSetup.java b/ccm-core/src/com/arsdigita/web/ApplicationSetup.java index 795e673e7..a67fecd5f 100755 --- a/ccm-core/src/com/arsdigita/web/ApplicationSetup.java +++ b/ccm-core/src/com/arsdigita/web/ApplicationSetup.java @@ -213,7 +213,7 @@ public class ApplicationSetup { notice("Done validating."); ApplicationType applicationType = process(); - Assert.assertNotNull(applicationType, "applicationType is not null"); + Assert.exists(applicationType, "applicationType is not null"); applicationType.save(); return applicationType; @@ -252,7 +252,7 @@ public class ApplicationSetup { // ApplicationType exists. if (m_key != null && !packageTypeIsInstalled(m_key)) { - Assert.assertTrue(m_packageType == null); + Assert.isTrue(m_packageType == null); m_category.warn ("ApplicationType " + m_typeName + " did not have " + diff --git a/ccm-core/src/com/arsdigita/web/ApplicationType.java b/ccm-core/src/com/arsdigita/web/ApplicationType.java index 08ee95730..40f9818d0 100755 --- a/ccm-core/src/com/arsdigita/web/ApplicationType.java +++ b/ccm-core/src/com/arsdigita/web/ApplicationType.java @@ -49,38 +49,26 @@ import org.apache.log4j.Logger; * @version $Id: ApplicationType.java 1520 2007-03-22 13:36:04Z chrisgilbert23 $ */ public class ApplicationType extends ResourceType { - // public static final String versionId = - // "$Id: ApplicationType.java 1520 2007-03-22 13:36:04Z chrisgilbert23 $" + - // "$Author: chrisgilbert23 $" + - // "$DateTime: 2004/08/16 18:10:38 $"; + /** The logging object for this class. */ private static final Logger s_log = Logger.getLogger (ApplicationType.class); + /** + * The fully qualified model name of the underlying data object, which in + * this case is the same as the Java type. + */ public static final String BASE_DATA_OBJECT_TYPE = "com.arsdigita.web.ApplicationType"; - protected String getBaseDataObjectType() { - return BASE_DATA_OBJECT_TYPE; - } - private PackageType m_packageType; boolean m_legacyFree = false; - // ensure legacy free instance variable is set correctly - // previously only set on creation of application type - // (to be honest I can't remember the problem that was - // causing, but it did cause a problem in some - // circumstances) - public void initialize() { - super.initialize(); - s_log.debug("initialising application type "); - if (!isNew() && getPackageType() == null) { - s_log.debug("legacy free type"); - m_legacyFree = true; - - } - } + /** + * Constructor. + * + * @param dataObject + */ public ApplicationType(DataObject dataObject) { super(dataObject); } @@ -95,7 +83,7 @@ public class ApplicationType extends ResourceType { this(objectType, title, applicationObjectType, false); } - + protected ApplicationType(final String objectType, final String title, final String applicationObjectType, @@ -115,6 +103,26 @@ public class ApplicationType extends ResourceType { m_legacyFree = true; } + protected String getBaseDataObjectType() { + return BASE_DATA_OBJECT_TYPE; + } + + // ensure legacy free instance variable is set correctly + // previously only set on creation of application type + // (to be honest I can't remember the problem that was + // causing, but it did cause a problem in some + // circumstances) + public void initialize() { + super.initialize(); + s_log.debug("initialising application type "); + if (!isNew() && getPackageType() == null) { + s_log.debug("legacy free type"); + m_legacyFree = true; + + } + } + + private void setDefaults() { // Defaults for standalone applications. setFullPageView(true); @@ -154,9 +162,9 @@ public class ApplicationType extends ResourceType { boolean createContainerGroup) { this(dataObjectType); - Assert.assertNotNull(title, "title"); - Assert.assertNotNull(applicationObjectType, "applicationObjectType"); - Assert.assertNotNull(packageType, "packageType"); + Assert.exists(title, "title"); + Assert.exists(applicationObjectType, "applicationObjectType"); + Assert.exists(packageType, "packageType"); m_packageType = packageType; setPackageType(m_packageType); @@ -195,8 +203,8 @@ public class ApplicationType extends ResourceType { private static final PackageType makePackageType(String key, String title) { PackageType packageType = new PackageType(); - Assert.assertNotNull(key, "key"); - Assert.assertNotNull(title, "title"); + Assert.exists(key, "key"); + Assert.exists(title, "title"); packageType.setKey(key); packageType.setDisplayName(title); @@ -242,7 +250,7 @@ public class ApplicationType extends ResourceType { } // Param public static ApplicationType retrieveApplicationType(BigDecimal id) { - Assert.assertNotNull(id, "id"); + Assert.exists(id, "id"); return ApplicationType.retrieveApplicationType (new OID(ApplicationType.BASE_DATA_OBJECT_TYPE, id)); @@ -250,11 +258,11 @@ public class ApplicationType extends ResourceType { // Param oid cannot be null. public static ApplicationType retrieveApplicationType(OID oid) { - Assert.assertNotNull(oid, "oid"); + Assert.exists(oid, "oid"); DataObject dataObject = SessionManager.getSession().retrieve(oid); - Assert.assertNotNull(dataObject); + Assert.exists(dataObject); return ApplicationType.retrieveApplicationType(dataObject); } @@ -262,7 +270,7 @@ public class ApplicationType extends ResourceType { // Param dataObject cannot be null. Can return null? public static ApplicationType retrieveApplicationType (DataObject dataObject) { - Assert.assertNotNull(dataObject, "dataObject"); + Assert.exists(dataObject, "dataObject"); return new ApplicationType(dataObject); } @@ -270,7 +278,7 @@ public class ApplicationType extends ResourceType { // Can return null. public static ApplicationType retrieveApplicationTypeForApplication (String applicationObjectType) { - Assert.assertNotNull(applicationObjectType, "applicationObjectType"); + Assert.exists(applicationObjectType, "applicationObjectType"); DataCollection collection = SessionManager.getSession().retrieve(BASE_DATA_OBJECT_TYPE); @@ -293,7 +301,7 @@ public class ApplicationType extends ResourceType { DataCollection collection = SessionManager.getSession().retrieve(BASE_DATA_OBJECT_TYPE); - Assert.assertNotNull(collection, "collection"); + Assert.exists(collection, "collection"); collection.addEqualsFilter("hasFullPageView", Boolean.TRUE); @@ -332,8 +340,7 @@ public class ApplicationType extends ResourceType { ("This method is only supported for legacy application types"); } - Assert.assertNotNull(packageType, "packageType"); - + Assert.exists(packageType, "packageType"); setAssociation("packageType", packageType); } @@ -382,13 +389,13 @@ public class ApplicationType extends ResourceType { public String getTitle() { String title = (String) get("title"); - Assert.assertNotNull(title, "title"); + Assert.exists(title, "title"); return title; } public void setTitle(String title) { - Assert.assertNotNull(title, "title"); + Assert.exists(title, "title"); set("title", title); } @@ -408,7 +415,7 @@ public class ApplicationType extends ResourceType { public boolean isWorkspaceApplication() { final Boolean result = (Boolean) get("isWorkspaceApplication"); - Assert.assertNotNull(result, "Boolean result"); + Assert.exists(result, "Boolean result"); return result.booleanValue(); } @@ -431,7 +438,7 @@ public class ApplicationType extends ResourceType { public boolean hasFullPageView() { final Boolean result = (Boolean) get("hasFullPageView"); - Assert.assertNotNull(result, "Boolean result"); + Assert.exists(result, "Boolean result"); return result.booleanValue(); } @@ -454,7 +461,7 @@ public class ApplicationType extends ResourceType { public boolean hasEmbeddedView() { final Boolean result = (Boolean) get("hasEmbeddedView"); - Assert.assertNotNull(result, "Boolean result"); + Assert.exists(result, "Boolean result"); return result.booleanValue(); } @@ -491,8 +498,7 @@ public class ApplicationType extends ResourceType { *

    Get the list of relevant privileges for this * ApplicationType.

    * - * @return A Collection of {@link PrivilegeDescriptor - * PrivilegeDescriptors} + * @return A Collection of {@link PrivilegeDescriptor PrivilegeDescriptors} */ public Collection getRelevantPrivileges() { LinkedList result = new LinkedList(); @@ -550,13 +556,13 @@ public class ApplicationType extends ResourceType { public String getApplicationObjectType() { String objectType = (String)get("objectType"); - Assert.assertNotNull(objectType); + Assert.exists(objectType); return objectType; } protected void setApplicationObjectType(String objectType) { - Assert.assertNotNull(objectType); + Assert.exists(objectType); set("objectType", objectType); } @@ -585,7 +591,7 @@ public class ApplicationType extends ResourceType { public boolean isSingleton() { final Boolean result = (Boolean) get("isSingleton"); - Assert.assertNotNull(result, "Boolean result"); + Assert.exists(result, "Boolean result"); return result.booleanValue(); } @@ -598,7 +604,7 @@ public class ApplicationType extends ResourceType { public BigDecimal getID() { BigDecimal id = (BigDecimal)get("id"); - Assert.assertNotNull(id, "id"); + Assert.exists(id, "id"); return id; } @@ -627,7 +633,8 @@ public class ApplicationType extends ResourceType { } public void createGroup () { - Assert.equal(getGroup(), null, "Group has already been created for Application Type " + getTitle()); + Assert.isEqual(getGroup(), null, "Group has already been created for " + + "Application Type " + getTitle()); Group group = new Group(); group.setName(getTitle() + " Groups"); setAssociation("containerGroup", group); diff --git a/ccm-core/src/com/arsdigita/web/ApplicationTypeCollection.java b/ccm-core/src/com/arsdigita/web/ApplicationTypeCollection.java index 6ad2fd652..60cd348f1 100755 --- a/ccm-core/src/com/arsdigita/web/ApplicationTypeCollection.java +++ b/ccm-core/src/com/arsdigita/web/ApplicationTypeCollection.java @@ -73,7 +73,7 @@ public class ApplicationTypeCollection extends ResourceTypeCollection { public ApplicationType getApplicationType() { DataObject dataObject = m_dataCollection.getDataObject(); - Assert.assertNotNull(dataObject, "dataObject"); + Assert.exists(dataObject, "dataObject"); ApplicationType applicationType = ApplicationType.retrieveApplicationType(dataObject); diff --git a/ccm-core/src/com/arsdigita/web/CachePolicy.java b/ccm-core/src/com/arsdigita/web/CachePolicy.java index 8a348fc7f..a9f04fd44 100755 --- a/ccm-core/src/com/arsdigita/web/CachePolicy.java +++ b/ccm-core/src/com/arsdigita/web/CachePolicy.java @@ -44,13 +44,13 @@ public abstract class CachePolicy { public final void implement(final HttpServletRequest sreq, final HttpServletResponse sresp) { if (Assert.isEnabled()) { - Assert.truth(!sresp.isCommitted()); + Assert.isTrue(!sresp.isCommitted()); } doImplement(sreq, sresp); if (Assert.isEnabled()) { - Assert.truth(!sresp.isCommitted()); + Assert.isTrue(!sresp.isCommitted()); } } diff --git a/ccm-core/src/com/arsdigita/web/ContextRegistrationServlet.java b/ccm-core/src/com/arsdigita/web/ContextRegistrationServlet.java index 71717e15f..18e0f061d 100755 --- a/ccm-core/src/com/arsdigita/web/ContextRegistrationServlet.java +++ b/ccm-core/src/com/arsdigita/web/ContextRegistrationServlet.java @@ -62,8 +62,8 @@ public class ContextRegistrationServlet extends HttpServlet { public void init(final ServletConfig sconfig) throws ServletException { m_uri = sconfig.getInitParameter("uri"); Assert.exists(m_uri, String.class); - Assert.truth(m_uri.startsWith("/"), "uri starts with /"); - Assert.truth(m_uri.endsWith("/"), "uri ends with /"); + Assert.isTrue(m_uri.startsWith("/"), "uri starts with /"); + Assert.isTrue(m_uri.endsWith("/"), "uri ends with /"); Web.registerServletContext(m_uri, sconfig.getServletContext()); diff --git a/ccm-core/src/com/arsdigita/web/GlobalizationParameterListener.java b/ccm-core/src/com/arsdigita/web/GlobalizationParameterListener.java index 7fb9add1f..d61bc1a20 100755 --- a/ccm-core/src/com/arsdigita/web/GlobalizationParameterListener.java +++ b/ccm-core/src/com/arsdigita/web/GlobalizationParameterListener.java @@ -49,7 +49,7 @@ class GlobalizationParameterListener implements ParameterListener { if (value == null) { final Locale locale = Kernel.getContext().getLocale(); - Assert.assertNotNull(locale, "Locale locale"); + Assert.exists(locale, "Locale locale"); map.setParameter(Globalization.ENCODING_PARAM_NAME, Globalization.getDefaultCharset(locale)); diff --git a/ccm-core/src/com/arsdigita/web/LegacyAdapterServlet.java b/ccm-core/src/com/arsdigita/web/LegacyAdapterServlet.java index 400f8ecfc..9f89cd153 100755 --- a/ccm-core/src/com/arsdigita/web/LegacyAdapterServlet.java +++ b/ccm-core/src/com/arsdigita/web/LegacyAdapterServlet.java @@ -88,7 +88,7 @@ public class LegacyAdapterServlet extends BaseApplicationServlet { s_log.debug("Using package type '" + type.getKey() + "'"); } - Assert.assertNotNull(type, "PackageType type"); + Assert.exists(type, "PackageType type"); String jsp = "/packages/" + type.getKey() + "/www" + sreq.getPathInfo(); File file = new File(getServletContext().getRealPath(jsp)); @@ -98,18 +98,18 @@ public class LegacyAdapterServlet extends BaseApplicationServlet { RequestDispatcher rd = sreq.getRequestDispatcher(jsp); - Assert.assertNotNull(rd, "RequestDispatcher rd"); + Assert.exists(rd, "RequestDispatcher rd"); rd.forward(sreq, sresp); } else { try { RequestContext rc = DispatcherHelper.getRequestContext(); - Assert.assertNotNull(rc, "RequestContext rc"); + Assert.exists(rc, "RequestContext rc"); Dispatcher dispatcher = type.getDispatcher(); - Assert.assertNotNull(dispatcher, "Dispatcher dispatcher"); + Assert.exists(dispatcher, "Dispatcher dispatcher"); if (s_log.isDebugEnabled()) { s_log.debug diff --git a/ccm-core/src/com/arsdigita/web/ParameterMap.java b/ccm-core/src/com/arsdigita/web/ParameterMap.java index ba71ecdd4..ef59be8ff 100755 --- a/ccm-core/src/com/arsdigita/web/ParameterMap.java +++ b/ccm-core/src/com/arsdigita/web/ParameterMap.java @@ -94,7 +94,7 @@ public class ParameterMap implements Cloneable { } public static final ParameterMap fromString(final String query) { - Assert.assertNotNull(query, "String query"); + Assert.exists(query, "String query"); if (query.startsWith("?")) { return new ParameterMap(query.substring(1)); @@ -161,9 +161,9 @@ public class ParameterMap implements Cloneable { final int end) throws DecoderException { final int sep = query.indexOf('=', start); - if (Assert.isAssertEnabled()) { - Assert.assertTrue(start > -1); - Assert.assertTrue(end > -1); + if (Assert.isEnabled()) { + Assert.isTrue(start > -1); + Assert.isTrue(end > -1); } if (sep > -1) { @@ -195,10 +195,10 @@ public class ParameterMap implements Cloneable { } private void validateName(final String name) { - Assert.assertNotNull(name, "String name"); - Assert.assertTrue(!name.equals(""), + Assert.exists(name, "String name"); + Assert.isTrue(!name.equals(""), "The name must not be the empty string"); - Assert.assertTrue(name.indexOf(" ") == -1, + Assert.isTrue(name.indexOf(" ") == -1, "The name must not contain any spaces: '" + name + "'"); } @@ -232,7 +232,7 @@ public class ParameterMap implements Cloneable { * @pre name != null && !name.trim().equals("") */ public final void setParameter(final String name, final String value) { - if (Assert.isAssertEnabled()) { + if (Assert.isEnabled()) { validateName(name); } @@ -267,10 +267,10 @@ public class ParameterMap implements Cloneable { public final void setParameterValues(final String name, final String[] values) { - if (Assert.isAssertEnabled()) { + if (Assert.isEnabled()) { validateName(name); - Assert.assertNotNull(values, "String[] values"); - Assert.assertTrue(values.length > 0, + Assert.exists(values, "String[] values"); + Assert.isTrue(values.length > 0, "The values array must have at least one value"); } @@ -278,7 +278,7 @@ public class ParameterMap implements Cloneable { } public final void clearParameter(final String name) { - if (Assert.isAssertEnabled()) { + if (Assert.isEnabled()) { validateName(name); } @@ -325,15 +325,15 @@ public class ParameterMap implements Cloneable { final String key = (String) entry.getKey(); final String[] values = (String[]) entry.getValue(); - if (Assert.isAssertEnabled()) { - Assert.assertTrue(key.indexOf('%') == -1, + if (Assert.isEnabled()) { + Assert.isTrue(key.indexOf('%') == -1, "The key '" + key + "' has already been " + "encoded"); } if (values != null) { - if (Assert.isAssertEnabled()) { - Assert.assertTrue(values.toString().indexOf('%') == -1, + if (Assert.isEnabled()) { + Assert.isTrue(values.toString().indexOf('%') == -1, "One of the values " + Arrays.asList(values) + " has " + "already been encoded"); diff --git a/ccm-core/src/com/arsdigita/web/PrefixerServlet.java b/ccm-core/src/com/arsdigita/web/PrefixerServlet.java index e530fd401..97f2e332e 100755 --- a/ccm-core/src/com/arsdigita/web/PrefixerServlet.java +++ b/ccm-core/src/com/arsdigita/web/PrefixerServlet.java @@ -50,8 +50,8 @@ public class PrefixerServlet extends HttpServlet { m_prefix = config.getInitParameter(PREFIX_PARAMETER); - Assert.assertNotNull(m_prefix, "String m_prefix"); - Assert.assertTrue(m_prefix.startsWith("/"), + Assert.exists(m_prefix, "String m_prefix"); + Assert.isTrue(m_prefix.startsWith("/"), "The target prefix must start with a '/'"); } diff --git a/ccm-core/src/com/arsdigita/web/RedirectSignal.java b/ccm-core/src/com/arsdigita/web/RedirectSignal.java index f347b71b1..a6501c1e0 100755 --- a/ccm-core/src/com/arsdigita/web/RedirectSignal.java +++ b/ccm-core/src/com/arsdigita/web/RedirectSignal.java @@ -63,9 +63,9 @@ public class RedirectSignal extends TransactionSignal { public RedirectSignal(final String url, final boolean isCommitRequested) { super(isCommitRequested); - if (Assert.isAssertEnabled()) { - Assert.assertNotNull(url, "String url"); - Assert.assertTrue(url.startsWith("http") || url.startsWith("/"), + if (Assert.isEnabled()) { + Assert.exists(url, "String url"); + Assert.isTrue(url.startsWith("http") || url.startsWith("/"), "The URL is relative and won't dispatch " + "correctly under some servlet containers; " + "the URL is '" + url + "'"); diff --git a/ccm-core/src/com/arsdigita/web/ReturnSignal.java b/ccm-core/src/com/arsdigita/web/ReturnSignal.java index 60b6fa012..6f6158fab 100755 --- a/ccm-core/src/com/arsdigita/web/ReturnSignal.java +++ b/ccm-core/src/com/arsdigita/web/ReturnSignal.java @@ -55,7 +55,7 @@ public class ReturnSignal extends RedirectSignal { final String returnURL = sreq.getParameter("return_url"); - Assert.assertNotNull(returnURL, "String returnURL"); + Assert.exists(returnURL, "String returnURL"); if (s_log.isDebugEnabled()) { s_log.debug("Redirecting to URL '" + returnURL + "'"); @@ -68,7 +68,7 @@ public class ReturnSignal extends RedirectSignal { final String fallback) { s_log.debug("Fetching the return URL to redirect to"); - Assert.assertNotNull(fallback, "String fallback"); + Assert.exists(fallback, "String fallback"); final String returnURL = sreq.getParameter("return_url"); diff --git a/ccm-core/src/com/arsdigita/web/URL.java b/ccm-core/src/com/arsdigita/web/URL.java index 177cc469d..dd910971c 100755 --- a/ccm-core/src/com/arsdigita/web/URL.java +++ b/ccm-core/src/com/arsdigita/web/URL.java @@ -183,29 +183,29 @@ public class URL { m_url = new StringBuffer(96); m_params = params; - if (Assert.isAssertEnabled()) { - Assert.assertNotNull(scheme, "String scheme"); - Assert.assertTrue(!scheme.equals(""), + if (Assert.isEnabled()) { + Assert.exists(scheme, "String scheme"); + Assert.isTrue(!scheme.equals(""), "The scheme cannot be an empty string"); - Assert.assertNotNull(serverName, "String serverName"); - Assert.assertTrue(serverPort > 0, + Assert.exists(serverName, "String serverName"); + Assert.isTrue(serverPort > 0, "The serverPort must be greater than 0; " + "I got " + serverPort); - Assert.assertNotNull(contextPath, "String contextPath"); + Assert.exists(contextPath, "String contextPath"); if (contextPath.startsWith("/")) { - Assert.assertTrue + Assert.isTrue (!contextPath.endsWith("/"), "A contextPath starting with '/' must not end in '/'; " + "I got '" + contextPath + "'"); } - Assert.assertNotNull(servletPath, "String servletPath"); + Assert.exists(servletPath, "String servletPath"); if (pathInfo != null) { - Assert.assertTrue(pathInfo.startsWith("/"), + Assert.isTrue(pathInfo.startsWith("/"), "I expected a pathInfo starting with '/' " + "and got '" + pathInfo + "' instead"); } @@ -242,12 +242,12 @@ public class URL { m_url.append(pathInfo); } - if (Assert.isAssertEnabled()) { - Assert.assertTrue(m_schemeEnd > -1); - Assert.assertTrue(m_serverNameEnd > -1); - Assert.assertTrue(m_serverPortEnd > -1); - Assert.assertTrue(m_contextPathEnd > -1); - Assert.assertTrue(m_servletPathEnd > -1); + if (Assert.isEnabled()) { + Assert.isTrue(m_schemeEnd > -1); + Assert.isTrue(m_serverNameEnd > -1); + Assert.isTrue(m_serverPortEnd > -1); + Assert.isTrue(m_contextPathEnd > -1); + Assert.isTrue(m_servletPathEnd > -1); } } @@ -671,8 +671,8 @@ public class URL { final ParameterMap params) { final WebConfig config = Web.getConfig(); - Assert.assertNotNull(sreq, "HttpServletRequest sreq"); - Assert.assertNotNull(config, "WebConfig config"); + Assert.exists(sreq, "HttpServletRequest sreq"); + Assert.exists(config, "WebConfig config"); if (params != null) { params.runListeners(sreq); @@ -712,8 +712,8 @@ public class URL { return there(sreq, path, params); } - Assert.assertNotNull(sreq, "HttpServletRequest sreq"); - Assert.assertNotNull(config, "WebConfig config"); + Assert.exists(sreq, "HttpServletRequest sreq"); + Assert.exists(config, "WebConfig config"); if (params != null) { params.runListeners(sreq); @@ -746,8 +746,8 @@ public class URL { final String path) { final WebConfig config = Web.getConfig(); - Assert.assertNotNull(sreq, "HttpServletRequest sreq"); - Assert.assertNotNull(config, "WebConfig config"); + Assert.exists(sreq, "HttpServletRequest sreq"); + Assert.exists(config, "WebConfig config"); final HttpHost host = new HttpHost(sreq); @@ -779,8 +779,8 @@ public class URL { final Application app, final String pathInfo, final ParameterMap params) { - if (Assert.isAssertEnabled() && pathInfo != null) { - Assert.assertTrue(pathInfo.startsWith("/"), + if (Assert.isEnabled() && pathInfo != null) { + Assert.isTrue(pathInfo.startsWith("/"), "pathInfo, if not null, must " + "start with a slash"); } @@ -806,8 +806,8 @@ public class URL { public static final URL there(final HttpServletRequest sreq, final Application app, final String pathInfo) { - if (Assert.isAssertEnabled() && pathInfo != null) { - Assert.assertTrue(pathInfo.startsWith("/"), + if (Assert.isEnabled() && pathInfo != null) { + Assert.isTrue(pathInfo.startsWith("/"), "pathInfo, if not null, must " + "start with a slash"); } @@ -859,7 +859,7 @@ public class URL { final ParameterMap params) { final Application app = Web.getContext().getApplication(); - Assert.assertNotNull(app, "Application app"); + Assert.exists(app, "Application app"); return URL.there(sreq, app, pathInfo, params); } @@ -868,7 +868,7 @@ public class URL { final String pathInfo) { final Application app = Web.getContext().getApplication(); - Assert.assertNotNull(app, "Application app"); + Assert.exists(app, "Application app"); return URL.there(sreq, app, pathInfo); } diff --git a/ccm-core/src/com/arsdigita/web/WebContext.java b/ccm-core/src/com/arsdigita/web/WebContext.java index 02ce5e137..11e519eb0 100755 --- a/ccm-core/src/com/arsdigita/web/WebContext.java +++ b/ccm-core/src/com/arsdigita/web/WebContext.java @@ -101,7 +101,7 @@ public final class WebContext extends Record { } final void setRequestURL(final URL url) { - Assert.assertNotNull(url, "URL url"); + Assert.exists(url, "URL url"); m_requestURL = url; diff --git a/ccm-core/src/com/arsdigita/workflow/simple/UserTask.java b/ccm-core/src/com/arsdigita/workflow/simple/UserTask.java index 9582b57f7..16e6cbba7 100755 --- a/ccm-core/src/com/arsdigita/workflow/simple/UserTask.java +++ b/ccm-core/src/com/arsdigita/workflow/simple/UserTask.java @@ -279,7 +279,7 @@ public class UserTask extends Task implements Assignable { * Marks the task as finished. (persistent operation) *

    This operation is only valid if the * task is enabled. - * Only the user who previously locked the task can call this + * Only the user who previously isLocked the task can call this * method. * * @param user the user who checks off the task @@ -484,7 +484,7 @@ public class UserTask extends Task implements Assignable { /** * Releases the lock on the task if it is currently - * locked. (persistent operation) + * isLocked. (persistent operation) * * @param user the user who is unlocking the task * @@ -497,8 +497,8 @@ public class UserTask extends Task implements Assignable { /** - * Checks whether the task is locked by a user. - * @return true if the task is locked + * Checks whether the task is isLocked by a user. + * @return true if the task is isLocked * by a user; false otherwise. * @@ -509,8 +509,8 @@ public class UserTask extends Task implements Assignable { /** - * Retrieves the user who locked the process. - * @return the user who locked the process. + * Retrieves the user who isLocked the process. + * @return the user who isLocked the process. * */ public User getLockedUser() { @@ -897,7 +897,7 @@ public class UserTask extends Task implements Assignable { m_notificationSender = (Party) DomainObjectFactory.newInstance (new OID(Party.BASE_DATA_OBJECT_TYPE,senderID)); - Assert.assertNotNull + Assert.exists (m_notificationSender, "Party m_notificationSender"); } catch (DataObjectNotFoundException e) { throw new UncheckedWrapperException("Error restoring notification sender", diff --git a/ccm-core/src/com/redhat/persistence/pdl/VersioningMetadata.java b/ccm-core/src/com/redhat/persistence/pdl/VersioningMetadata.java index 1c61c83e7..d1f394550 100755 --- a/ccm-core/src/com/redhat/persistence/pdl/VersioningMetadata.java +++ b/ccm-core/src/com/redhat/persistence/pdl/VersioningMetadata.java @@ -195,7 +195,7 @@ public class VersioningMetadata { return ((ObjectTypeNd) parent).getQualifiedName(); } - Assert.truth(parent instanceof AssociationNd, + Assert.isTrue(parent instanceof AssociationNd, "parent instanceof AssociationNd"); AssociationNd assoc = (AssociationNd) parent; diff --git a/ccm-core/src/com/redhat/persistence/profiler/rdbms/StatementProfiler.java b/ccm-core/src/com/redhat/persistence/profiler/rdbms/StatementProfiler.java index f22b23085..9c0e89dbe 100755 --- a/ccm-core/src/com/redhat/persistence/profiler/rdbms/StatementProfiler.java +++ b/ccm-core/src/com/redhat/persistence/profiler/rdbms/StatementProfiler.java @@ -101,7 +101,7 @@ public class StatementProfiler implements RDBMSProfiler { public void start() { if (Assert.isEnabled()) { - Assert.truth(m_out == null); + Assert.isTrue(m_out == null); } try { diff --git a/ccm-docmgr/src/com/arsdigita/cms/docmgr/DocFolder.java b/ccm-docmgr/src/com/arsdigita/cms/docmgr/DocFolder.java index 5d6ce40ff..7c6342e2a 100755 --- a/ccm-docmgr/src/com/arsdigita/cms/docmgr/DocFolder.java +++ b/ccm-docmgr/src/com/arsdigita/cms/docmgr/DocFolder.java @@ -47,7 +47,8 @@ public class DocFolder extends Folder implements Resource { try { setContentType(ContentType.findByAssociatedObjectType(BASE_DATA_OBJECT_TYPE)); } catch(DataObjectNotFoundException e) { - throw new UncheckedWrapperException( (String) GlobalizationUtil.globalize("cms.contenttypes.event_type_not_registered").localize(), e); + throw new UncheckedWrapperException( (String) GlobalizationUtil.globalize( + "cms.contenttypes.event_type_not_registered").localize(), e); } } diff --git a/ccm-docmgr/src/com/arsdigita/cms/docmgr/DocLink.java b/ccm-docmgr/src/com/arsdigita/cms/docmgr/DocLink.java index 8110112ed..3a5c61e60 100755 --- a/ccm-docmgr/src/com/arsdigita/cms/docmgr/DocLink.java +++ b/ccm-docmgr/src/com/arsdigita/cms/docmgr/DocLink.java @@ -180,7 +180,7 @@ public class DocLink extends ContentPage implements Resource, Searchable { int suffixLen = suffix.length(); docName = docName.substring(0,(200 - suffixLen)); docName = docName + suffix; - Assert.truth(docName.length() < 201 , "Actual Length is: " + docName.length()); + Assert.isTrue(docName.length() < 201 , "Actual Length is: " + docName.length()); return docName; } else{ return buf.toString(); diff --git a/ccm-docmgr/src/com/arsdigita/cms/docmgr/DocumentCollection.java b/ccm-docmgr/src/com/arsdigita/cms/docmgr/DocumentCollection.java index d703c9c69..9496f858c 100755 --- a/ccm-docmgr/src/com/arsdigita/cms/docmgr/DocumentCollection.java +++ b/ccm-docmgr/src/com/arsdigita/cms/docmgr/DocumentCollection.java @@ -46,7 +46,7 @@ public class DocumentCollection extends DomainCollection { public DomainObject getDomainObject() { DomainObject domainObject = getDocument(); - Assert.assertNotNull(domainObject); + Assert.exists(domainObject); return domainObject; } @@ -61,7 +61,7 @@ public class DocumentCollection extends DomainCollection { Document doc = Document.retrieveDocument(dataObject); - Assert.assertNotNull(doc); + Assert.exists(doc); return doc; } diff --git a/ccm-docmgr/src/com/arsdigita/cms/docmgr/Repository.java b/ccm-docmgr/src/com/arsdigita/cms/docmgr/Repository.java index 1d2f8a35f..d8ff77963 100755 --- a/ccm-docmgr/src/com/arsdigita/cms/docmgr/Repository.java +++ b/ccm-docmgr/src/com/arsdigita/cms/docmgr/Repository.java @@ -127,7 +127,7 @@ public class Repository extends Application { KernelExcursion excursion = new KernelExcursion() { protected void excurse() { setParty(Kernel.getSystemParty()); - Assert.assertNotNull(m_root, "Folder m_root"); + Assert.exists(m_root, "Folder m_root"); if (s_repositoryRoot == null) { m_root.setParent(cs.getRootFolder()); s_log.debug("typical repository (no legacy folder)"); @@ -177,7 +177,7 @@ public class Repository extends Application { protected void excurse() { setParty(Kernel.getSystemParty()); - Assert.assertNotNull(m_root, "Folder m_root"); + Assert.exists(m_root, "Folder m_root"); PermissionService.setContext(m_root, rep); s_log.debug("set context for "+m_root.getTitle()); diff --git a/ccm-docmgr/src/com/arsdigita/cms/docmgr/dispatcher/DocumentAssetPage.java b/ccm-docmgr/src/com/arsdigita/cms/docmgr/dispatcher/DocumentAssetPage.java index cae820ffb..3915bc666 100755 --- a/ccm-docmgr/src/com/arsdigita/cms/docmgr/dispatcher/DocumentAssetPage.java +++ b/ccm-docmgr/src/com/arsdigita/cms/docmgr/dispatcher/DocumentAssetPage.java @@ -83,7 +83,7 @@ public class DocumentAssetPage extends CMSPage { throw new ServletException(e.getMessage()); } - Assert.truth(doc instanceof Document, + Assert.isTrue(doc instanceof Document, "document is not a document" + doc.getID().toString()); diff --git a/ccm-docmgr/src/com/arsdigita/cms/docmgr/dispatcher/MultilingualDocumentResolver.java b/ccm-docmgr/src/com/arsdigita/cms/docmgr/dispatcher/MultilingualDocumentResolver.java index 2c44ca98e..ea74f0fd8 100755 --- a/ccm-docmgr/src/com/arsdigita/cms/docmgr/dispatcher/MultilingualDocumentResolver.java +++ b/ccm-docmgr/src/com/arsdigita/cms/docmgr/dispatcher/MultilingualDocumentResolver.java @@ -105,9 +105,9 @@ public class MultilingualDocumentResolver extends AbstractItemResolver implement " at URL '" + url + "' for context " + context); } - Assert.assertNotNull(section, "ContentSection section"); - Assert.assertNotNull(url, "String url"); - Assert.assertNotNull(context, "String context"); + Assert.exists(section, "ContentSection section"); + Assert.exists(url, "String url"); + Assert.exists(context, "String context"); Folder rootFolder = section.getRootFolder(); url = stripTemplateFromURL(url); @@ -125,7 +125,7 @@ public class MultilingualDocumentResolver extends AbstractItemResolver implement // We allow for returning null, so the root folder may // not be live. - //Assert.assertTrue(rootFolder.isLive(), + //Assert.isTrue(rootFolder.isLive(), // "live context - root folder of secion must be live"); // If the context is 'live', we need the live item. @@ -171,8 +171,8 @@ public class MultilingualDocumentResolver extends AbstractItemResolver implement // and return FIXME: Please hack this if there is // more graceful solution. [aavetyan] - if (Assert.isAssertEnabled()) { - Assert.assertTrue + if (Assert.isEnabled()) { + Assert.isTrue (url.indexOf(ITEM_ID) >= 0, "url must contain parameter " + ITEM_ID); } @@ -307,9 +307,9 @@ public class MultilingualDocumentResolver extends AbstractItemResolver implement context + "' with name '" + name + "'"); } - Assert.assertNotNull(itemId, "BigDecimal itemId"); - Assert.assertNotNull(context, "Sring context"); - Assert.assertNotNull(section, "ContentSection section"); + Assert.exists(itemId, "BigDecimal itemId"); + Assert.exists(context, "Sring context"); + Assert.exists(section, "ContentSection section"); if (ContentItem.DRAFT.equals(context)) { // No template context here. @@ -321,9 +321,9 @@ public class MultilingualDocumentResolver extends AbstractItemResolver implement } else if (ContentItem.LIVE.equals(context)) { ContentItem item = new ContentItem(itemId); - if (Assert.isAssertEnabled()) { - Assert.assertNotNull(item, "item"); - Assert.assertTrue(ContentItem.LIVE.equals(item.getVersion()), + if (Assert.isEnabled()) { + Assert.exists(item, "item"); + Assert.isTrue(ContentItem.LIVE.equals(item.getVersion()), "Generating " + ContentItem.LIVE + " " + "URL; this item must be the live version"); } @@ -377,16 +377,16 @@ public class MultilingualDocumentResolver extends AbstractItemResolver implement context); } - Assert.assertNotNull(item, "ContentItem item"); - Assert.assertNotNull(context, "String context"); + Assert.exists(item, "ContentItem item"); + Assert.exists(context, "String context"); if (section == null) { section = item.getContentSection(); } if (ContentItem.DRAFT.equals(context)) { - if (Assert.isAssertEnabled()) { - Assert.assertTrue(ContentItem.DRAFT.equals(item.getVersion()), + if (Assert.isEnabled()) { + Assert.isTrue(ContentItem.DRAFT.equals(item.getVersion()), "Generating " + ContentItem.DRAFT + " url: item must be draft version"); } @@ -395,8 +395,8 @@ public class MultilingualDocumentResolver extends AbstractItemResolver implement } else if (CMSDispatcher.PREVIEW.equals(context)) { return generatePreviewURL(section, item, templateContext); } else if (ContentItem.LIVE.equals(context)) { - if (Assert.isAssertEnabled()) { - Assert.assertTrue(ContentItem.LIVE.equals(item.getVersion()), + if (Assert.isEnabled()) { + Assert.isTrue(ContentItem.LIVE.equals(item.getVersion()), "Generating " + ContentItem.LIVE + " url: item must be live version"); } @@ -449,8 +449,8 @@ public class MultilingualDocumentResolver extends AbstractItemResolver implement " and section " + section); } - if (Assert.isAssertEnabled()) { - Assert.assertTrue(section != null && itemId != null, + if (Assert.isEnabled()) { + Assert.isTrue(section != null && itemId != null, "get draft url: neither secion nor item " + "can be null"); } @@ -576,8 +576,8 @@ public class MultilingualDocumentResolver extends AbstractItemResolver implement protected String generatePreviewURL(ContentSection section, ContentItem item, String templateContext) { - Assert.assertNotNull(section, "ContentSection section"); - Assert.assertNotNull(item, "ContentItem item"); + Assert.exists(section, "ContentSection section"); + Assert.exists(item, "ContentItem item"); final StringBuffer url = new StringBuffer(100); url.append(section.getPath()); @@ -651,8 +651,8 @@ public class MultilingualDocumentResolver extends AbstractItemResolver implement // XXX this is wrong: here we abort on not finding the // parameter; below we return null. - if (Assert.isAssertEnabled()) { - Assert.assertTrue(pos >= 0, + if (Assert.isEnabled()) { + Assert.isTrue(pos >= 0, "Draft URL must contain parameter " + ITEM_ID); } @@ -670,7 +670,7 @@ public class MultilingualDocumentResolver extends AbstractItemResolver implement pos++; // skip the "=" - // ID is the string between the equal (at pos) and the next separator + // ID is the string between the isEqual (at pos) and the next separator int i = item_id.indexOf(SEPARATOR); item_id = item_id.substring(pos, Math.min(i, item_id.length() -1)); @@ -854,9 +854,9 @@ public class MultilingualDocumentResolver extends AbstractItemResolver implement lang = null; // no extension, so we cannot guess the language } - if (Assert.isAssertEnabled()) { - Assert.assertNotNull(name, "String name"); - Assert.assertTrue(lang == null || lang.length() == 2); + if (Assert.isEnabled()) { + Assert.exists(name, "String name"); + Assert.isTrue(lang == null || lang.length() == 2); } if (s_log.isDebugEnabled()) { diff --git a/ccm-docmgr/src/com/arsdigita/cms/docmgr/ui/CategoryItemsBrowser.java b/ccm-docmgr/src/com/arsdigita/cms/docmgr/ui/CategoryItemsBrowser.java index 5d944e2f1..edcdd1d11 100755 --- a/ccm-docmgr/src/com/arsdigita/cms/docmgr/ui/CategoryItemsBrowser.java +++ b/ccm-docmgr/src/com/arsdigita/cms/docmgr/ui/CategoryItemsBrowser.java @@ -109,7 +109,7 @@ public class CategoryItemsBrowser extends DataTable implements DMConstants { * {@link com.arsdigita.cms.ContentItem#DRAFT} or {@link com.arsdigita.cms.ContentItem#LIVE} */ public void setContext(String context) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); m_context = context; } @@ -227,7 +227,7 @@ public class CategoryItemsBrowser extends DataTable implements DMConstants { DomainObject d = DomainObjectFactory.newInstance((DataObject)value); - Assert.assertTrue(d instanceof ContentPage); + Assert.isTrue(d instanceof ContentPage); ContentPage p = (ContentPage)d; Label l = new Label(p.getName() + diff --git a/ccm-docmgr/src/com/arsdigita/cms/docmgr/ui/DMConstants.java b/ccm-docmgr/src/com/arsdigita/cms/docmgr/ui/DMConstants.java index aba334220..3f00fb1cb 100755 --- a/ccm-docmgr/src/com/arsdigita/cms/docmgr/ui/DMConstants.java +++ b/ccm-docmgr/src/com/arsdigita/cms/docmgr/ui/DMConstants.java @@ -252,10 +252,10 @@ public interface DMConstants { */ Label DESTINATION_FOLDER_PANEL_HEADER = new Label( - new GlobalizedMessage("ui.folder.destination.list.header", BUNDLE_NAME)); + new GlobalizedMessage("ui.folder.destination.list.header", BUNDLE_NAME)); Label FOLDER_EMPTY_LABEL = new Label( - new GlobalizedMessage("ui.folder.empty", BUNDLE_NAME)); + new GlobalizedMessage("ui.folder.empty", BUNDLE_NAME)); GlobalizedMessage FOLDER_NEW_FOLDER_LINK = new GlobalizedMessage("ui.action.newfolder", BUNDLE_NAME); @@ -269,22 +269,22 @@ public interface DMConstants { new GlobalizedMessage("ui.link.action.newdoclink", BUNDLE_NAME); Label ACTION_CUT_LABEL = new Label( - new GlobalizedMessage("ui.action.edit.cut", BUNDLE_NAME)); + new GlobalizedMessage("ui.action.edit.cut", BUNDLE_NAME)); Label ACTION_COPY_LABEL = new Label( - new GlobalizedMessage("ui.action.edit.copy", BUNDLE_NAME)); + new GlobalizedMessage("ui.action.edit.copy", BUNDLE_NAME)); Label ACTION_DELETE_LABEL = new Label( - new GlobalizedMessage("ui.action.edit.delete", BUNDLE_NAME)); + new GlobalizedMessage("ui.action.edit.delete", BUNDLE_NAME)); GlobalizedMessage ACTION_DELETE_CONFIRM = new GlobalizedMessage("ui.action.delete.confirm", BUNDLE_NAME); Label ACTION_ERROR_LABEL = new Label( - new GlobalizedMessage("ui.action.error", BUNDLE_NAME)); + new GlobalizedMessage("ui.action.error", BUNDLE_NAME)); Label ACTION_ERROR_CONTINUE = new Label( - new GlobalizedMessage("ui.action.error.continue", BUNDLE_NAME)); + new GlobalizedMessage("ui.action.error.continue", BUNDLE_NAME)); String ACTION_CUT_VALUE = "resource-cut"; String ACTION_COPY_VALUE = "resource-copy"; @@ -421,10 +421,10 @@ public interface DMConstants { String FOLDER_DESCRIPTION = "folder-description"; Label FOLDER_NAME_LABEL = new Label( - new GlobalizedMessage("ui.folder.name", BUNDLE_NAME)); + new GlobalizedMessage("ui.folder.name", BUNDLE_NAME)); Label FOLDER_DESCRIPTION_LABEL = new Label( - new GlobalizedMessage("ui.folder.description", BUNDLE_NAME)); + new GlobalizedMessage("ui.folder.description", BUNDLE_NAME)); GlobalizedMessage FOLDER_SAVE = new GlobalizedMessage("ui.folder.save", BUNDLE_NAME); @@ -440,13 +440,13 @@ public interface DMConstants { */ Label SEND_FRIEND_FORM_EMAIL_SUBJECT = new Label( - new GlobalizedMessage("ui.send.friend.email.subject", BUNDLE_NAME)); + new GlobalizedMessage("ui.send.friend.email.subject", BUNDLE_NAME)); Label SEND_FRIEND_FORM_EMAIL_LIST = new Label( - new GlobalizedMessage("ui.send.friend.email.list", BUNDLE_NAME)); + new GlobalizedMessage("ui.send.friend.email.list", BUNDLE_NAME)); Label SEND_FRIEND_FORM_DESCRIPTION = new Label( - new GlobalizedMessage("ui.send.friend.description", BUNDLE_NAME)); + new GlobalizedMessage("ui.send.friend.description", BUNDLE_NAME)); GlobalizedMessage SEND_FRIEND_FORM_SUBMIT = new GlobalizedMessage("ui.send.friend.submit", BUNDLE_NAME); diff --git a/ccm-docmgr/src/com/arsdigita/cms/docmgr/ui/DocmgrBasePage.java b/ccm-docmgr/src/com/arsdigita/cms/docmgr/ui/DocmgrBasePage.java index 239af4ef9..36f0ecb96 100755 --- a/ccm-docmgr/src/com/arsdigita/cms/docmgr/ui/DocmgrBasePage.java +++ b/ccm-docmgr/src/com/arsdigita/cms/docmgr/ui/DocmgrBasePage.java @@ -189,7 +189,8 @@ public class DocmgrBasePage extends Page implements DMConstants { } protected void buildGlobal(Container global) { - Link link = new Link( new Label(GlobalizationUtil.globalize("cw.workspace.sign_out")), "/register/logout"); + Link link = new Link( new Label(GlobalizationUtil.globalize("cw.workspace.sign_out")), + "/register/logout"); link.setClassAttr("signoutLink"); @@ -303,7 +304,7 @@ public class DocmgrBasePage extends Page implements DMConstants { * @param pc the component to be added */ public void add(Component pc) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); m_body.add(pc); } diff --git a/ccm-docmgr/src/com/arsdigita/cms/docmgr/ui/FileEditForm.java b/ccm-docmgr/src/com/arsdigita/cms/docmgr/ui/FileEditForm.java index 2817aca90..4bdd75918 100755 --- a/ccm-docmgr/src/com/arsdigita/cms/docmgr/ui/FileEditForm.java +++ b/ccm-docmgr/src/com/arsdigita/cms/docmgr/ui/FileEditForm.java @@ -339,7 +339,7 @@ class FileEditForm extends Form if (fpath != null && fpath.length() > 0) { HttpServletRequest mreq = e.getPageState().getRequest(); - Assert.truth(mreq instanceof MultipartHttpServletRequest, + Assert.isTrue(mreq instanceof MultipartHttpServletRequest, "I got a " + mreq + " when I was " + "expecting a MultipartHttpServletRequest"); diff --git a/ccm-docmgr/src/com/arsdigita/cms/docmgr/ui/FileUploadForm.java b/ccm-docmgr/src/com/arsdigita/cms/docmgr/ui/FileUploadForm.java index 44ba004fe..8428d7fc0 100755 --- a/ccm-docmgr/src/com/arsdigita/cms/docmgr/ui/FileUploadForm.java +++ b/ccm-docmgr/src/com/arsdigita/cms/docmgr/ui/FileUploadForm.java @@ -151,7 +151,7 @@ public class FileUploadForm extends Form if (fpath != null && fpath.length() > 0) { HttpServletRequest mreq = e.getPageState().getRequest(); - Assert.assertTrue(mreq instanceof MultipartHttpServletRequest, + Assert.isTrue(mreq instanceof MultipartHttpServletRequest, "I got a " + mreq + " when I was " + "expecting a MultipartHttpServletRequest"); diff --git a/ccm-docmgr/src/com/arsdigita/cms/docmgr/ui/RecentUpdatedDocsPortlet.java b/ccm-docmgr/src/com/arsdigita/cms/docmgr/ui/RecentUpdatedDocsPortlet.java index 1f339dca0..bf2ec1d2f 100755 --- a/ccm-docmgr/src/com/arsdigita/cms/docmgr/ui/RecentUpdatedDocsPortlet.java +++ b/ccm-docmgr/src/com/arsdigita/cms/docmgr/ui/RecentUpdatedDocsPortlet.java @@ -55,7 +55,8 @@ import com.arsdigita.xml.Element; */ public class RecentUpdatedDocsPortlet extends AppPortlet { - public static final String BASE_DATA_OBJECT_TYPE = "com.arsdigita.cms.docmgr.ui.RecentUpdatedDocsPortlet"; + public static final String BASE_DATA_OBJECT_TYPE = + "com.arsdigita.cms.docmgr.ui.RecentUpdatedDocsPortlet"; protected String getBaseDataObjectType() { return BASE_DATA_OBJECT_TYPE; @@ -89,7 +90,8 @@ class RecentUpdatedDocsPortletRenderer extends AbstractPortletRenderer implement // Table with 6 columns String[] tableHeaders = { "File", "Type", "Size", "Author", "Date", "" }; - DataQuery files = SessionManager.getSession().retrieveQuery("com.arsdigita.cms.docmgr.ui.RecentUpdatedDocs"); + DataQuery files = SessionManager.getSession().retrieveQuery( + "com.arsdigita.cms.docmgr.ui.RecentUpdatedDocs"); files.setParameter("ancestors", "%/" + rep.getRoot().getID().toString() + "/%"); files.setParameter("maxRows", new Integer(10)); @@ -98,7 +100,9 @@ class RecentUpdatedDocsPortletRenderer extends AbstractPortletRenderer implement while (files.next()) { Object[] tableRow = new Object[6]; - Resource res = (Resource) DomainObjectFactory.newInstance(new OID((String) files.get("objectType"), files.get("docID"))); + Resource res = (Resource) DomainObjectFactory.newInstance( + new OID((String) files.get("objectType"), + files.get("docID"))); Document document = null; DocLink docLink = null; boolean isExternalLink = false; @@ -113,7 +117,9 @@ class RecentUpdatedDocsPortletRenderer extends AbstractPortletRenderer implement document = (Document) res; } if (isExternalLink) { - tableRow[0] = new ExternalLink(res.getTitle(), docLink.getExternalURL()); + tableRow[0] = new ExternalLink( + res.getTitle(), + docLink.getExternalURL()); tableRow[1] = "Link"; tableRow[2] = ""; tableRow[3] = ""; @@ -125,11 +131,16 @@ class RecentUpdatedDocsPortletRenderer extends AbstractPortletRenderer implement else { tableRow[4] = ""; } - tableRow[5] = new ExternalLink("download", docLink.getExternalURL()); + tableRow[5] = new ExternalLink( + "download", + docLink.getExternalURL()); } else { // File name column. - tableRow[0] = new Link(document.getTitle(), fileURL + "/?" + FILE_ID_PARAM_NAME + "=" + document.getID()); + tableRow[0] = new Link( + document.getTitle(), + fileURL + "/?" + FILE_ID_PARAM_NAME + + "=" + document.getID()); tableRow[1] = document.getPrettyMimeType(); long fileSize = document.getSize().longValue(); @@ -146,7 +157,10 @@ class RecentUpdatedDocsPortletRenderer extends AbstractPortletRenderer implement tableRow[4] = ""; } // Download column - Link link = new Link("Download", fileURL + "/download/?" + FILE_ID_PARAM_NAME + "=" + document.getID().toString()); + Link link = new Link("Download", fileURL + + "/download/?" + + FILE_ID_PARAM_NAME + "=" + + document.getID().toString()); //+ resource.getResourceID()); link.setClassAttr("downloadLink"); tableRow[5] = link; @@ -159,12 +173,14 @@ class RecentUpdatedDocsPortletRenderer extends AbstractPortletRenderer implement GridPanel panel = new GridPanel(1); addResourceLinks(panel, rep); if (tableDataList.isEmpty()) { - panel.add(new Label(REPOSITORY_RECENTDOCS_EMPTY.localize(req).toString())); + panel.add(new Label(REPOSITORY_RECENTDOCS_EMPTY. + localize(req).toString())); panel.generateXML(pageState, parentElement); return; } else { - Object[][] tableData = (Object[][]) tableDataList.toArray(new Object[0][0]); + Object[][] tableData = (Object[][]) tableDataList. + toArray(new Object[0][0]); Table table = new Table(tableData, tableHeaders); panel.add(table, GridPanel.FULL_WIDTH); panel.generateXML(pageState, parentElement); @@ -174,19 +190,24 @@ class RecentUpdatedDocsPortletRenderer extends AbstractPortletRenderer implement private void addResourceLinks(GridPanel panel, Repository rep) { User user = Web.getContext().getUser(); - if (!PermissionService.checkPermission(new PermissionDescriptor(PrivilegeDescriptor.CREATE, rep, user))) { + if (!PermissionService.checkPermission(new PermissionDescriptor( + PrivilegeDescriptor.CREATE, rep, user))) { // don't show resource links return; } // new document - Link addResourceLink = new Link(new Label(ROOT_ADD_RESOURCE_LINK), m_portlet.getParentApplication().getPath() + "?" + Link addResourceLink = new Link(new Label(ROOT_ADD_RESOURCE_LINK), + m_portlet.getParentApplication().getPath() + "?" + ROOT_ADD_DOC_PARAM.getName() + "=t"); addResourceLink.setClassAttr("actionLink"); panel.add(addResourceLink, GridPanel.FULL_WIDTH | GridPanel.RIGHT | GridPanel.BOTTOM); // new doclink - addResourceLink = new Link(new Label(ROOT_ADD_DOCLINK_LINK), m_portlet.getParentApplication().getPath() + "?" + PARAM_ROOT_ADD_DOC_LINK + "="); + addResourceLink = new Link(new Label( + ROOT_ADD_DOCLINK_LINK), + m_portlet.getParentApplication().getPath() + + "?" + PARAM_ROOT_ADD_DOC_LINK + "="); addResourceLink.setClassAttr("actionLink"); panel.add(addResourceLink, GridPanel.FULL_WIDTH | GridPanel.RIGHT | GridPanel.BOTTOM); diff --git a/ccm-docmgr/src/com/arsdigita/docmgr/File.java b/ccm-docmgr/src/com/arsdigita/docmgr/File.java index 6a5d211eb..036b05004 100755 --- a/ccm-docmgr/src/com/arsdigita/docmgr/File.java +++ b/ccm-docmgr/src/com/arsdigita/docmgr/File.java @@ -139,7 +139,7 @@ public class File extends ResourceImpl implements Constants { } public static File retrieveFile(DataObject dataObject) { - Assert.assertNotNull(dataObject); + Assert.exists(dataObject); return new File(dataObject); } diff --git a/ccm-docmgr/src/com/arsdigita/docmgr/Repository.java b/ccm-docmgr/src/com/arsdigita/docmgr/Repository.java index 371a79eab..ada2bdb69 100755 --- a/ccm-docmgr/src/com/arsdigita/docmgr/Repository.java +++ b/ccm-docmgr/src/com/arsdigita/docmgr/Repository.java @@ -125,7 +125,7 @@ public class Repository extends Application implements Constants { protected void excurse() { setParty(Kernel.getSystemParty()); - Assert.assertNotNull(m_root, "Folder m_root"); + Assert.exists(m_root, "Folder m_root"); PermissionService.setContext(m_root, Repository.this); } diff --git a/ccm-docmgr/src/com/arsdigita/docmgr/ResourceImplCollection.java b/ccm-docmgr/src/com/arsdigita/docmgr/ResourceImplCollection.java index 8c7a87570..12624c0b3 100755 --- a/ccm-docmgr/src/com/arsdigita/docmgr/ResourceImplCollection.java +++ b/ccm-docmgr/src/com/arsdigita/docmgr/ResourceImplCollection.java @@ -45,7 +45,7 @@ public class ResourceImplCollection extends DomainCollection { public DomainObject getDomainObject() { DomainObject domainObject = getResourceImpl(); - Assert.assertNotNull(domainObject); + Assert.exists(domainObject); return domainObject; } @@ -60,7 +60,7 @@ public class ResourceImplCollection extends DomainCollection { File rimpl = File.retrieveFile(dataObject); - Assert.assertNotNull(rimpl); + Assert.exists(rimpl); return rimpl; } diff --git a/ccm-docmgr/src/com/arsdigita/docmgr/ui/DocmgrBasePage.java b/ccm-docmgr/src/com/arsdigita/docmgr/ui/DocmgrBasePage.java index a7a64b40e..bd14aca10 100755 --- a/ccm-docmgr/src/com/arsdigita/docmgr/ui/DocmgrBasePage.java +++ b/ccm-docmgr/src/com/arsdigita/docmgr/ui/DocmgrBasePage.java @@ -286,7 +286,7 @@ public class DocmgrBasePage extends Page { * @param pc the component to be added */ public void add(Component pc) { - Assert.assertNotLocked(this); + Assert.isUnlocked(this); m_body.add(pc); } diff --git a/ccm-docmgr/src/com/arsdigita/docmgr/ui/FileUploadForm.java b/ccm-docmgr/src/com/arsdigita/docmgr/ui/FileUploadForm.java index 2f52cfff5..c2dbd415b 100755 --- a/ccm-docmgr/src/com/arsdigita/docmgr/ui/FileUploadForm.java +++ b/ccm-docmgr/src/com/arsdigita/docmgr/ui/FileUploadForm.java @@ -158,7 +158,7 @@ public class FileUploadForm extends Form if (fpath != null && fpath.length() > 0) { HttpServletRequest mreq = e.getPageState().getRequest(); - Assert.assertTrue(mreq instanceof MultipartHttpServletRequest, + Assert.isTrue(mreq instanceof MultipartHttpServletRequest, "I got a " + mreq + " when I was " + "expecting a MultipartHttpServletRequest"); diff --git a/ccm-forum/src/com/arsdigita/forum/ForumPageFactory.java b/ccm-forum/src/com/arsdigita/forum/ForumPageFactory.java index 1fab84d4c..3f7ce915c 100644 --- a/ccm-forum/src/com/arsdigita/forum/ForumPageFactory.java +++ b/ccm-forum/src/com/arsdigita/forum/ForumPageFactory.java @@ -47,7 +47,7 @@ public class ForumPageFactory { } public static Page getPage(String pageType) { - Assert.truth(pageBuilders.containsKey(pageType), "Requested page type (" + pageType + ") does not have a builder registered" ); + Assert.isTrue(pageBuilders.containsKey(pageType), "Requested page type (" + pageType + ") does not have a builder registered" ); PageBuilder builder = (PageBuilder)pageBuilders.get(pageType); Page page = builder.buildPage(); page.lock(); diff --git a/ccm-forum/src/com/arsdigita/forum/PopulateForum.java b/ccm-forum/src/com/arsdigita/forum/PopulateForum.java index 6e026b4bb..64068c68a 100755 --- a/ccm-forum/src/com/arsdigita/forum/PopulateForum.java +++ b/ccm-forum/src/com/arsdigita/forum/PopulateForum.java @@ -55,8 +55,8 @@ public class PopulateForum extends AbstractPopulateApp implements PopulateApp { int iThreads = ((Integer)args.get(0)).intValue(); int iMsgs = ((Integer)args.get(1)).intValue(); - Assert.truth(iThreads >= 0, "iThreads must be >= 0"); - Assert.truth(iMsgs > 0, "iMsgs must be > 0"); + Assert.isTrue(iThreads >= 0, "iThreads must be >= 0"); + Assert.isTrue(iMsgs > 0, "iMsgs must be > 0"); //get users to make posts List users = Utilities.getUsersIDs(10); diff --git a/ccm-forum/src/com/arsdigita/forum/Post.java b/ccm-forum/src/com/arsdigita/forum/Post.java index 3241454aa..7c04559e7 100755 --- a/ccm-forum/src/com/arsdigita/forum/Post.java +++ b/ccm-forum/src/com/arsdigita/forum/Post.java @@ -18,11 +18,11 @@ */ package com.arsdigita.forum; -import java.math.BigDecimal; - -import org.apache.log4j.Logger; - -import com.arsdigita.bebop.PageState; +import java.math.BigDecimal; + +import org.apache.log4j.Logger; + +import com.arsdigita.bebop.PageState; import com.arsdigita.categorization.CategorizedObject; import com.arsdigita.categorization.Category; import com.arsdigita.categorization.CategoryCollection; @@ -31,8 +31,8 @@ import com.arsdigita.cms.lifecycle.LifecycleDefinition; import com.arsdigita.cms.lifecycle.LifecycleService; import com.arsdigita.domain.DataObjectNotFoundException; import com.arsdigita.domain.DomainObjectFactory; -import com.arsdigita.forum.ui.PostForm; -import com.arsdigita.kernel.ACSObject; +import com.arsdigita.forum.ui.PostForm; +import com.arsdigita.kernel.ACSObject; import com.arsdigita.kernel.Kernel; import com.arsdigita.kernel.KernelExcursion; import com.arsdigita.kernel.Party; @@ -40,8 +40,8 @@ import com.arsdigita.kernel.permissions.PermissionService; import com.arsdigita.messaging.MessageThread; import com.arsdigita.messaging.ThreadedMessage; import com.arsdigita.notification.Notification; -import com.arsdigita.persistence.DataAssociation; -import com.arsdigita.persistence.DataAssociationCursor; +import com.arsdigita.persistence.DataAssociation; +import com.arsdigita.persistence.DataAssociationCursor; import com.arsdigita.persistence.DataCollection; import com.arsdigita.persistence.DataObject; import com.arsdigita.persistence.OID; @@ -108,8 +108,8 @@ import com.arsdigita.util.Assert; * *

*

- * - * + * + * * @author Kevin Scaldeferri (kevin@arsdigita.com) * @author Nobuko Asakai (nasakai@redhat.com) */ @@ -125,16 +125,16 @@ public class Post extends ThreadedMessage { * message */ public static final String MODERATOR = "moderator"; - /** - * 0..n association with PostImageAttachments - */ - public static final String IMAGE_ATTACHMENTS = "images"; - - /** - * 0..n association with PostFileAttachments - */ - public static final String FILE_ATTACHMENTS = "files"; - + /** + * 0..n association with PostImageAttachments + */ + public static final String IMAGE_ATTACHMENTS = "images"; + + /** + * 0..n association with PostFileAttachments + */ + public static final String FILE_ATTACHMENTS = "files"; + /** The status strings */ public static final String PENDING = "pending"; public static final String APPROVED = "approved"; @@ -148,8 +148,8 @@ public class Post extends ThreadedMessage { private Party m_moderator; - // referred to afterSave method - private boolean m_wasNew; + // referred to afterSave method + private boolean m_wasNew; /* * The base DomainObject is Post which extends ThreadedMessage. In @@ -163,7 +163,7 @@ public class Post extends ThreadedMessage { this(BASE_DATA_OBJECT_TYPE); } - public Post(String typeName) { + public Post(String typeName) { super(typeName); } @@ -171,24 +171,24 @@ public class Post extends ThreadedMessage { super(oid); } - public Post(BigDecimal id) { - this(new OID(BASE_DATA_OBJECT_TYPE, id)); - } - + public Post(BigDecimal id) { + this(new OID(BASE_DATA_OBJECT_TYPE, id)); + } + public Post(DataObject obj) { super(obj); } /** - * Creates a new Posting in a forum. The post is - * not yet in a fit state to be saved as it needs - * it's status to be set, and the subject and message - * + * Creates a new Posting in a forum. The post is + * not yet in a fit state to be saved as it needs + * it's status to be set, and the subject and message + * * @param forum the owner forum */ public static Post create(Forum forum) { Post post = new Post(); - post.setForum(forum); + post.setForum(forum); return post; } @@ -197,8 +197,8 @@ public class Post extends ThreadedMessage { } /** - * overridden version of method in ThreadedMessage - * used to create a reply to an existing post + * overridden version of method in ThreadedMessage + * used to create a reply to an existing post */ public ThreadedMessage newInstance() { return create(getForum()); @@ -209,7 +209,7 @@ public class Post extends ThreadedMessage { * before saving. */ protected void beforeSave() { - m_wasNew = isNew(); + m_wasNew = isNew(); Forum forum = getForum(); Assert.exists(forum, Forum.class); @@ -224,12 +224,12 @@ public class Post extends ThreadedMessage { } - /** - * set permission contexts for this post to the root post, and for the root - * post to the forum. Additionally create a lifecycle if required for a new - * root post - */ - + /** + * set permission contexts for this post to the root post, and for the root + * post to the forum. Additionally create a lifecycle if required for a new + * root post + */ + protected void afterSave() { super.afterSave(); Forum forum = getForum(); @@ -238,51 +238,51 @@ public class Post extends ThreadedMessage { s_log.info("Setting context for " + getOID() + " to " + root.getOID()); PermissionService.setContext(this, root); - s_log.info( - "Setting context for " + root.getOID() + " to " + + s_log.info( + "Setting context for " + root.getOID() + " to " + forum.getOID()); PermissionService.setContext(root, forum); - // originally this was created in beforeSave, but this was when only noticeboard - // (reply disabled) forums could have a lifecycle. Now that all forums may - // have a lifecycle on root posts, the method needs to be here in order - // for persistence to work when users are replying to posts chris.gilbert@westsussex.gov.uk - - if (m_wasNew) { - if (getRoot() == null && forum.getExpireAfter() > 0) { - s_log.info("Creating expiration lifecycle for " + getOID()); - setLifecycle(forum.getLifecycleDefinition()); - } - } - m_wasNew = false; - - DataAssociationCursor files = getFiles(); - - // allow attached files to be returned in search results - // by setting their status as live - while (files.next()) { - PostFileAttachment file = - (PostFileAttachment) DomainObjectFactory.newInstance( - files.getDataObject()); - if (getStatus().equals(APPROVED)) { - file.setLive(); - } else { - file.setDraft(); - } - - } + // originally this was created in beforeSave, but this was when only noticeboard + // (reply disabled) forums could have a lifecycle. Now that all forums may + // have a lifecycle on root posts, the method needs to be here in order + // for persistence to work when users are replying to posts chris.gilbert@westsussex.gov.uk + + if (m_wasNew) { + if (getRoot() == null && forum.getExpireAfter() > 0) { + s_log.info("Creating expiration lifecycle for " + getOID()); + setLifecycle(forum.getLifecycleDefinition()); + } + } + m_wasNew = false; + + DataAssociationCursor files = getFiles(); + + // allow attached files to be returned in search results + // by setting their status as live + while (files.next()) { + PostFileAttachment file = + (PostFileAttachment) DomainObjectFactory.newInstance( + files.getDataObject()); + if (getStatus().equals(APPROVED)) { + file.setLive(); + } else { + file.setDraft(); + } + + } } /** * Sends out the notifications for any subscriptions to the forum * or thread to which this message belongs. Only sends - * notifications if the post is approved. + * notifications if the post is approved. */ - public void sendNotifications(final String context) { + public void sendNotifications(final String context) { KernelExcursion ex = new KernelExcursion() { protected void excurse() { setEffectiveParty(Kernel.getSystemParty()); - doSendNotifications(context); + doSendNotifications(context); } }; ex.run(); @@ -293,9 +293,9 @@ public class Post extends ThreadedMessage { * on for the forum. */ public void sendModeratorAlerts() { - - if (!getStatus().equals(APPROVED)) { - // don't send if pre-approved (ie posted by a moderator) + + if (!getStatus().equals(APPROVED)) { + // don't send if pre-approved (ie posted by a moderator) KernelExcursion ex = new KernelExcursion() { protected void excurse() { setEffectiveParty(Kernel.getSystemParty()); @@ -303,13 +303,13 @@ public class Post extends ThreadedMessage { } }; ex.run(); - } else { - s_log.debug("not sending moderator alerts because the post " + - "was pre-approved (created by an approver)"); - } + } else { + s_log.debug("not sending moderator alerts because the post " + + "was pre-approved (created by an approver)"); + } } - private void doSendNotifications(String context) { + private void doSendNotifications(String context) { s_log.debug("sending user notifications"); Forum forum = getForum(); if (getStatus().equals(APPROVED)) { @@ -322,25 +322,25 @@ public class Post extends ThreadedMessage { subscriptions.getDataObject()); s_log.debug("notification to " + subscription.getOID()); - subscription.sendNotification(Post.this, Forum.getConfig().deleteNotifications()); + subscription.sendNotification(Post.this, Forum.getConfig().deleteNotifications()); } s_log.debug("Sending thread level subsriptions"); - if (context == null || !context.equals(PostForm.NEW_CONTEXT)) { - + if (context == null || !context.equals(PostForm.NEW_CONTEXT)) { + ThreadSubscription sub = ThreadSubscription.getThreadSubscription(getThread()); - if (sub == null) { - s_log.error( - "Got a null ThreadSubscription from " - + "Post # " - + getID()); + if (sub == null) { + s_log.error( + "Got a null ThreadSubscription from " + + "Post # " + + getID()); } else { - sub.sendNotification(this, Forum.getConfig().deleteNotifications()); - } - + sub.sendNotification(this, Forum.getConfig().deleteNotifications()); + } + } - + } else { s_log.debug("Not sending notifications because the " + "message is not approved"); @@ -361,10 +361,10 @@ public class Post extends ThreadedMessage { while (alerts.next()) { ModerationAlert alert = (ModerationAlert) - DomainObjectFactory.newInstance( - alerts.getDataObject()); + DomainObjectFactory.newInstance( + alerts.getDataObject()); s_log.debug("Processing moderation alert " + alert.getOID()); - alert.sendNotification(this, Forum.getConfig().deleteNotifications()); + alert.sendNotification(this, Forum.getConfig().deleteNotifications()); } } else { s_log.debug("Not sending moderator alerts because the " + @@ -413,32 +413,32 @@ public class Post extends ThreadedMessage { */ public void clearCategories() { - DataCollection categories = - SessionManager.getSession().retrieve( - Category.BASE_DATA_OBJECT_TYPE); - categories.addEqualsFilter( - Category.CHILD_OBJECTS + "." + ACSObject.ID, - getID()); - while (categories.next()) { - Category cat = - (Category) DomainObjectFactory.newInstance( - categories.getDataObject()); - cat.removeChild(this); - } - - // above is slower than data operation implementation below, - // but data op caused problems in persistence. If edited post - // had topic unchanged, then attempt was made to assign topic - // category before data op had cleared existing. Hence exception - // - attempt to map object to same cat twice - - /* - DataOperation clearCategories = - SessionManager.getSession().retrieveDataOperation( - "com.arsdigita.forum.clearCategories"); + DataCollection categories = + SessionManager.getSession().retrieve( + Category.BASE_DATA_OBJECT_TYPE); + categories.addEqualsFilter( + Category.CHILD_OBJECTS + "." + ACSObject.ID, + getID()); + while (categories.next()) { + Category cat = + (Category) DomainObjectFactory.newInstance( + categories.getDataObject()); + cat.removeChild(this); + } + + // above is slower than data operation implementation below, + // but data op caused problems in persistence. If edited post + // had topic unchanged, then attempt was made to assign topic + // category before data op had cleared existing. Hence exception + // - attempt to map object to same cat twice + + /* + DataOperation clearCategories = + SessionManager.getSession().retrieveDataOperation( + "com.arsdigita.forum.clearCategories"); clearCategories.setParameter("postID", this.getID()); clearCategories.execute(); - return;*/ + return;*/ } /** @@ -449,41 +449,41 @@ public class Post extends ThreadedMessage { } /** - * creates a ThreadSubscription, and returns it but only if this is a root, - * else return null + * creates a ThreadSubscription, and returns it but only if this is a root, + * else return null * Note, you must save() the Post before calling this method. */ - public ThreadSubscription createThreadSubscription() { - ThreadSubscription sub = null; + public ThreadSubscription createThreadSubscription() { + ThreadSubscription sub = null; if (getRoot() == null) { - sub = new ThreadSubscription(); + sub = new ThreadSubscription(); sub.setThread(getThread()); sub.save(); } - return sub; - } - - public ThreadSubscription getSubscription() { - MessageThread thread; - if (getRoot() != null) { - thread = getRootMsg().getThread(); - } else { - thread = getThread(); - } - DataCollection subscriptions = - SessionManager.getSession().retrieve( - ThreadSubscription.BASE_DATA_OBJECT_TYPE); - subscriptions.addEqualsFilter( - ThreadSubscription.THREAD, - thread.getID()); - ThreadSubscription subscription = null; - while (subscriptions.next()) { - subscription = - (ThreadSubscription) DomainObjectFactory.newInstance( - subscriptions.getDataObject()); - - } - return subscription; + return sub; + } + + public ThreadSubscription getSubscription() { + MessageThread thread; + if (getRoot() != null) { + thread = getRootMsg().getThread(); + } else { + thread = getThread(); + } + DataCollection subscriptions = + SessionManager.getSession().retrieve( + ThreadSubscription.BASE_DATA_OBJECT_TYPE); + subscriptions.addEqualsFilter( + ThreadSubscription.THREAD, + thread.getID()); + ThreadSubscription subscription = null; + while (subscriptions.next()) { + subscription = + (ThreadSubscription) DomainObjectFactory.newInstance( + subscriptions.getDataObject()); + + } + return subscription; } /** @@ -494,16 +494,16 @@ public class Post extends ThreadedMessage { */ public boolean canEdit(Party party) { Party author = getFrom(); - // cg added - for anonymous posts, don't allow editing, else everyone could edit everyone else's posts - return ( - !author.equals(Kernel.getPublicUser()) - && Forum.getConfig().canAuthorEditPosts() + // cg added - for anonymous posts, don't allow editing, else everyone could edit everyone else's posts + return ( + !author.equals(Kernel.getPublicUser()) + && Forum.getConfig().canAuthorEditPosts() && author.equals(party)) || getForum().canEdit(party); } public void setStatus(String status) { - Assert.truth( + Assert.isTrue( (status.equals(APPROVED) || status.equals(REJECTED) || status.equals(REAPPROVE) @@ -520,38 +520,38 @@ public class Post extends ThreadedMessage { set(STATUS, status); } - /** - * set the status of a new post according to the priviliges of - * the current user - used by UI when creating new post or reply - * @param state - */ - public void setStatus(PageState state) { - setStatus(state, null); - } - - /** - * set the status of an edited post according to the privileges - * of the current user and the status of the post that is being - * edited - used by the edit post UI - * @param state - * @param previousStatus - */ - public void setStatus(PageState state, String previousStatus) { - ForumContext ctx = ForumContext.getContext(state); - Forum forum = ctx.getForum(); - // set status of edited post - if (forum.isModerated() && !ctx.canModerate()) { - if (Post.APPROVED.equals(previousStatus)) { - setStatus(Post.REAPPROVE); - } else { - setStatus(Post.PENDING); - } - } else { - setStatus(Post.APPROVED); - } - - } - + /** + * set the status of a new post according to the priviliges of + * the current user - used by UI when creating new post or reply + * @param state + */ + public void setStatus(PageState state) { + setStatus(state, null); + } + + /** + * set the status of an edited post according to the privileges + * of the current user and the status of the post that is being + * edited - used by the edit post UI + * @param state + * @param previousStatus + */ + public void setStatus(PageState state, String previousStatus) { + ForumContext ctx = ForumContext.getContext(state); + Forum forum = ctx.getForum(); + // set status of edited post + if (forum.isModerated() && !ctx.canModerate()) { + if (Post.APPROVED.equals(previousStatus)) { + setStatus(Post.REAPPROVE); + } else { + setStatus(Post.PENDING); + } + } else { + setStatus(Post.APPROVED); + } + + } + public String getStatus() { return (String)get(STATUS); } @@ -571,19 +571,19 @@ public class Post extends ThreadedMessage { return m_moderator; } - // note that the replies to this post are deleted in beforeDelete() of - // ThreadedMessage (and hence beforeDelete is called recursively on their replies) - + // note that the replies to this post are deleted in beforeDelete() of + // ThreadedMessage (and hence beforeDelete is called recursively on their replies) + protected void beforeDelete() { - s_log.debug("Post - before delete " + getID()); - - // threaded message recursively deletes children - super.beforeDelete(); - // remove any nt_requests - DataCollection requests = - SessionManager.getSession().retrieve( - Notification.BASE_DATA_OBJECT_TYPE); - requests.addEqualsFilter(Notification.MESSAGE_ID, this.getID()); + s_log.debug("Post - before delete " + getID()); + + // threaded message recursively deletes children + super.beforeDelete(); + // remove any nt_requests + DataCollection requests = + SessionManager.getSession().retrieve( + Notification.BASE_DATA_OBJECT_TYPE); + requests.addEqualsFilter(Notification.MESSAGE_ID, this.getID()); while (requests.next()) { Notification no = new Notification(requests.getDataObject().getOID()); no.setMessageDelete(Boolean.FALSE); @@ -591,23 +591,23 @@ public class Post extends ThreadedMessage { } if (getRoot() == null) { - s_log.debug( - "Root post - get rid of thread subscription and thread"); - // This posting is the root of the thread. Remove the thread subscription and thread - MessageThread thread = getThread(); - ThreadSubscription sub = - ThreadSubscription.getThreadSubscription(thread); - if (sub != null) { - // if unconfirmed post, then threadsubscription has not been created + s_log.debug( + "Root post - get rid of thread subscription and thread"); + // This posting is the root of the thread. Remove the thread subscription and thread + MessageThread thread = getThread(); + ThreadSubscription sub = + ThreadSubscription.getThreadSubscription(thread); + if (sub != null) { + // if unconfirmed post, then threadsubscription has not been created sub.delete(); - + } - if (thread != null) { - thread.delete(); + if (thread != null) { + thread.delete(); } } - } + } // package access only void setLifecycle(LifecycleDefinition life) { @@ -617,91 +617,91 @@ public class Post extends ThreadedMessage { cycle.save(); } - public void addImage(PostImageAttachment image) { - DataAssociation images = (DataAssociation) get(Post.IMAGE_ATTACHMENTS); - image.addToAssociation(images); - long currentImageCount = images.getDataAssociationCursor().size(); - image.setImageOrder((int) currentImageCount); - } - - public void removeImage(PostImageAttachment image) { - DataAssociation images = (DataAssociation) get(Post.IMAGE_ATTACHMENTS); - image.removeFromAssociation(images); - renumberImages(); - } - - // image order for a new image is based on the count of existing - // images, hence necessary to fill in any gaps when images are deleted - private void renumberImages() { - int count = 1; - DataAssociationCursor images = getImages(); - while (images.next()) { - PostImageAttachment image = - (PostImageAttachment) DomainObjectFactory.newInstance( - images.getDataObject()); - image.setImageOrder(count); - count++; - } - } - - public DataAssociationCursor getImages() { - DataAssociationCursor images = - ((DataAssociation) get(Post.IMAGE_ATTACHMENTS)) - .getDataAssociationCursor(); - images.addOrder(PostImageAttachment.IMAGE_ORDER); - return images; - } - - public void addFile(PostFileAttachment file) { - DataAssociation files = (DataAssociation) get(Post.FILE_ATTACHMENTS); - file.addToAssociation(files); - PermissionService.setContext(file, this); - long currentFileCount = files.getDataAssociationCursor().size(); - file.setFileOrder((int) currentFileCount); - } - - public void removeFile(PostFileAttachment file) { - DataAssociation files = (DataAssociation) get(Post.FILE_ATTACHMENTS); - file.removeFromAssociation(files); - renumberFiles(); - - } - - // file order for a new file is based on the count of existing - // files, hence necessary to fill in any gaps when images are deleted - - private void renumberFiles() { - int count = 1; - DataAssociationCursor files = getFiles(); - while (files.next()) { - PostFileAttachment file = - (PostFileAttachment) DomainObjectFactory.newInstance( - files.getDataObject()); - file.setFileOrder(count); - count++; - } - - } - - public DataAssociationCursor getFiles() { - DataAssociationCursor files = - ((DataAssociation) get(Post.FILE_ATTACHMENTS)) - .getDataAssociationCursor(); - files.addOrder(PostFileAttachment.FILE_ORDER); - return files; - - } - - - /** - * used by thread to prevent counting unapproved posts in the - * reply count. - * - */ - // should really be static - revisit this - refer to MessageThread for use - protected void addReplyFilter(DataCollection replies) { - replies.addEqualsFilter(STATUS, APPROVED); - - } + public void addImage(PostImageAttachment image) { + DataAssociation images = (DataAssociation) get(Post.IMAGE_ATTACHMENTS); + image.addToAssociation(images); + long currentImageCount = images.getDataAssociationCursor().size(); + image.setImageOrder((int) currentImageCount); + } + + public void removeImage(PostImageAttachment image) { + DataAssociation images = (DataAssociation) get(Post.IMAGE_ATTACHMENTS); + image.removeFromAssociation(images); + renumberImages(); + } + + // image order for a new image is based on the count of existing + // images, hence necessary to fill in any gaps when images are deleted + private void renumberImages() { + int count = 1; + DataAssociationCursor images = getImages(); + while (images.next()) { + PostImageAttachment image = + (PostImageAttachment) DomainObjectFactory.newInstance( + images.getDataObject()); + image.setImageOrder(count); + count++; + } + } + + public DataAssociationCursor getImages() { + DataAssociationCursor images = + ((DataAssociation) get(Post.IMAGE_ATTACHMENTS)) + .getDataAssociationCursor(); + images.addOrder(PostImageAttachment.IMAGE_ORDER); + return images; + } + + public void addFile(PostFileAttachment file) { + DataAssociation files = (DataAssociation) get(Post.FILE_ATTACHMENTS); + file.addToAssociation(files); + PermissionService.setContext(file, this); + long currentFileCount = files.getDataAssociationCursor().size(); + file.setFileOrder((int) currentFileCount); + } + + public void removeFile(PostFileAttachment file) { + DataAssociation files = (DataAssociation) get(Post.FILE_ATTACHMENTS); + file.removeFromAssociation(files); + renumberFiles(); + + } + + // file order for a new file is based on the count of existing + // files, hence necessary to fill in any gaps when images are deleted + + private void renumberFiles() { + int count = 1; + DataAssociationCursor files = getFiles(); + while (files.next()) { + PostFileAttachment file = + (PostFileAttachment) DomainObjectFactory.newInstance( + files.getDataObject()); + file.setFileOrder(count); + count++; + } + + } + + public DataAssociationCursor getFiles() { + DataAssociationCursor files = + ((DataAssociation) get(Post.FILE_ATTACHMENTS)) + .getDataAssociationCursor(); + files.addOrder(PostFileAttachment.FILE_ORDER); + return files; + + } + + + /** + * used by thread to prevent counting unapproved posts in the + * reply count. + * + */ + // should really be static - revisit this - refer to MessageThread for use + protected void addReplyFilter(DataCollection replies) { + replies.addEqualsFilter(STATUS, APPROVED); + + } } diff --git a/ccm-forum/src/com/arsdigita/forum/Subscription.java b/ccm-forum/src/com/arsdigita/forum/Subscription.java index d3f5be9db..77892db9a 100755 --- a/ccm-forum/src/com/arsdigita/forum/Subscription.java +++ b/ccm-forum/src/com/arsdigita/forum/Subscription.java @@ -72,7 +72,7 @@ public abstract class Subscription extends BaseSubscription { * @return a header to insert at the top of the alert. */ public String getHeader(ThreadedMessage msg) { - Assert.truth(msg instanceof Post, + Assert.isTrue(msg instanceof Post, "Parameter msg should be a Post"); Post post = (Post)msg; diff --git a/ccm-forum/src/com/arsdigita/forum/ui/ThreadDisplay.java b/ccm-forum/src/com/arsdigita/forum/ui/ThreadDisplay.java index 63c50686b..4f12d3539 100755 --- a/ccm-forum/src/com/arsdigita/forum/ui/ThreadDisplay.java +++ b/ccm-forum/src/com/arsdigita/forum/ui/ThreadDisplay.java @@ -18,41 +18,41 @@ */ package com.arsdigita.forum.ui; -import java.io.IOException; -import java.math.BigDecimal; - -import javax.servlet.ServletException; - -import org.apache.log4j.Logger; - +import java.io.IOException; +import java.math.BigDecimal; + +import javax.servlet.ServletException; + +import org.apache.log4j.Logger; + import com.arsdigita.bebop.Page; import com.arsdigita.bebop.PageState; -import com.arsdigita.bebop.SimpleComponent; -import com.arsdigita.bebop.parameters.IntegerParameter; +import com.arsdigita.bebop.SimpleComponent; +import com.arsdigita.bebop.parameters.IntegerParameter; import com.arsdigita.domain.DomainCollection; import com.arsdigita.domain.DomainObjectFactory; -import com.arsdigita.domain.DomainObjectXMLRenderer; -import com.arsdigita.forum.Forum; -import com.arsdigita.forum.ForumContext; -import com.arsdigita.forum.Post; +import com.arsdigita.domain.DomainObjectXMLRenderer; +import com.arsdigita.forum.Forum; +import com.arsdigita.forum.ForumContext; +import com.arsdigita.forum.Post; import com.arsdigita.kernel.Kernel; -import com.arsdigita.kernel.Party; -import com.arsdigita.kernel.permissions.PermissionDescriptor; -import com.arsdigita.kernel.permissions.PermissionService; -import com.arsdigita.kernel.permissions.PrivilegeDescriptor; +import com.arsdigita.kernel.Party; +import com.arsdigita.kernel.permissions.PermissionDescriptor; +import com.arsdigita.kernel.permissions.PermissionService; +import com.arsdigita.kernel.permissions.PrivilegeDescriptor; import com.arsdigita.kernel.ui.ACSObjectSelectionModel; import com.arsdigita.messaging.MessageThread; import com.arsdigita.messaging.ThreadedMessage; -import com.arsdigita.persistence.DataCollection; -import com.arsdigita.persistence.FilterFactory; -import com.arsdigita.persistence.OID; -import com.arsdigita.persistence.SessionManager; -import com.arsdigita.util.Assert; -import com.arsdigita.util.UncheckedWrapperException; +import com.arsdigita.persistence.DataCollection; +import com.arsdigita.persistence.FilterFactory; +import com.arsdigita.persistence.OID; +import com.arsdigita.persistence.SessionManager; +import com.arsdigita.util.Assert; +import com.arsdigita.util.UncheckedWrapperException; import com.arsdigita.web.ParameterMap; import com.arsdigita.web.RedirectSignal; -import com.arsdigita.web.URL; -import com.arsdigita.web.Web; +import com.arsdigita.web.URL; +import com.arsdigita.web.Web; import com.arsdigita.xml.Element; import com.arsdigita.xml.XML; @@ -63,7 +63,7 @@ public class ThreadDisplay extends SimpleComponent implements Constants { private IntegerParameter m_pageNumber = new IntegerParameter(PAGINATOR_PARAM); - private int m_pageSize = Forum.getConfig().getThreadPageSize(); + private int m_pageSize = Forum.getConfig().getThreadPageSize(); private static final String ACTION_EDIT = "edit"; private static final String ACTION_DELETE = "delete"; @@ -104,7 +104,7 @@ public class ThreadDisplay extends SimpleComponent implements Constants { m_post.setSelectedObject(state, post); m_threadComponent.makeEditFormVisible(state); } else if (ACTION_DELETE.equals(key)) { - Assert.truth(ctx.canAdminister(), "can administer forums"); + Assert.isTrue(ctx.canAdminister(), "can administer forums"); MessageThread thread = ctx.getMessageThread(); ThreadedMessage root = thread.getRootMessage(); @@ -147,7 +147,7 @@ public class ThreadDisplay extends SimpleComponent implements Constants { } else if (ACTION_APPROVE.equals(key)) { post.setStatus(Post.APPROVED); post.save(); - post.sendNotifications(null); + post.sendNotifications(null); } else if (ACTION_REJECT.equals(key)) { m_post.setSelectedObject(state, post); m_threadComponent.makeRejectFormVisible(state); @@ -203,7 +203,7 @@ public class ThreadDisplay extends SimpleComponent implements Constants { public void generateXML(PageState state, Element parent) { - Element content = parent.newChildElement(FORUM_XML_PREFIX + ":threadDisplay", + Element content = parent.newChildElement(FORUM_XML_PREFIX + ":threadDisplay", FORUM_XML_NS); exportAttributes(content); @@ -244,7 +244,7 @@ public class ThreadDisplay extends SimpleComponent implements Constants { while (messages.next()) { Post message = (Post)messages.getDomainObject(); - Element messageEl = content.newChildElement(FORUM_XML_PREFIX + ":message", + Element messageEl = content.newChildElement(FORUM_XML_PREFIX + ":message", FORUM_XML_NS); generateActionXML(state, messageEl, message); @@ -286,17 +286,17 @@ public class ThreadDisplay extends SimpleComponent implements Constants { Party party = Kernel.getContext().getParty(); - if (party == null) { - party = Kernel.getPublicUser(); - } + if (party == null) { + party = Kernel.getPublicUser(); + } if (post.canEdit(party)) { parent.addAttribute("editURL", makeURL(state, ACTION_EDIT, post)); } - PermissionDescriptor canRespond = new PermissionDescriptor(PrivilegeDescriptor.get(Forum.RESPOND_TO_THREAD_PRIVILEGE), Kernel.getContext().getResource(), party); - - if (!ctx.getForum().isNoticeboard() && PermissionService.checkPermission(canRespond)) { + PermissionDescriptor canRespond = new PermissionDescriptor(PrivilegeDescriptor.get(Forum.RESPOND_TO_THREAD_PRIVILEGE), Kernel.getContext().getResource(), party); + + if (!ctx.getForum().isNoticeboard() && PermissionService.checkPermission(canRespond)) { parent.addAttribute("replyURL", makeURL(state, ACTION_REPLY, post)); } @@ -325,7 +325,7 @@ public class ThreadDisplay extends SimpleComponent implements Constants { long begin, long end, long objectCount) { - Element paginator = parent.newChildElement(FORUM_XML_PREFIX + ":paginator", FORUM_XML_NS); + Element paginator = parent.newChildElement(FORUM_XML_PREFIX + ":paginator", FORUM_XML_NS); URL here = Web.getContext().getRequestURL(); ParameterMap params = new ParameterMap(here.getParameterMap()); diff --git a/ccm-gen-aplaws/src/com/arsdigita/aplaws/ObjectTypeTraversal.java b/ccm-gen-aplaws/src/com/arsdigita/aplaws/ObjectTypeTraversal.java index 802d77164..64d21a34e 100755 --- a/ccm-gen-aplaws/src/com/arsdigita/aplaws/ObjectTypeTraversal.java +++ b/ccm-gen-aplaws/src/com/arsdigita/aplaws/ObjectTypeTraversal.java @@ -310,7 +310,7 @@ public abstract class ObjectTypeTraversal { protected String nameFromPath(String path) { int index = path.lastIndexOf("/"); - Assert.truth(index >= 0, "Path starts with /"); + Assert.isTrue(index >= 0, "Path starts with /"); if (path.endsWith("+")) { return path.substring(index + 1, path.length() - 2); @@ -321,7 +321,7 @@ public abstract class ObjectTypeTraversal { protected String parentFromPath(String path) { int index = path.lastIndexOf("/"); - Assert.truth(index >= 0, "Path starts with /"); + Assert.isTrue(index >= 0, "Path starts with /"); if (index == 0) { return null; diff --git a/ccm-gen-aplaws/src/com/arsdigita/aplaws/ui/HomepageWorkspaceSelectionModel.java b/ccm-gen-aplaws/src/com/arsdigita/aplaws/ui/HomepageWorkspaceSelectionModel.java index ca8201159..aabacc935 100755 --- a/ccm-gen-aplaws/src/com/arsdigita/aplaws/ui/HomepageWorkspaceSelectionModel.java +++ b/ccm-gen-aplaws/src/com/arsdigita/aplaws/ui/HomepageWorkspaceSelectionModel.java @@ -172,7 +172,7 @@ public class HomepageWorkspaceSelectionModel { Workspace custom = null; try { custom = global.retrieveSubworkspaceForParty(party); - Assert.truth(custom.getParty() != null && + Assert.isTrue(custom.getParty() != null && custom.getParty().equals(party), "party is not null and not admin"); s_log.debug("Found exsting personal workspce"); diff --git a/ccm-ldn-aplaws/src/com/arsdigita/aplaws/ObjectTypeTraversal.java b/ccm-ldn-aplaws/src/com/arsdigita/aplaws/ObjectTypeTraversal.java index 802d77164..64d21a34e 100755 --- a/ccm-ldn-aplaws/src/com/arsdigita/aplaws/ObjectTypeTraversal.java +++ b/ccm-ldn-aplaws/src/com/arsdigita/aplaws/ObjectTypeTraversal.java @@ -310,7 +310,7 @@ public abstract class ObjectTypeTraversal { protected String nameFromPath(String path) { int index = path.lastIndexOf("/"); - Assert.truth(index >= 0, "Path starts with /"); + Assert.isTrue(index >= 0, "Path starts with /"); if (path.endsWith("+")) { return path.substring(index + 1, path.length() - 2); @@ -321,7 +321,7 @@ public abstract class ObjectTypeTraversal { protected String parentFromPath(String path) { int index = path.lastIndexOf("/"); - Assert.truth(index >= 0, "Path starts with /"); + Assert.isTrue(index >= 0, "Path starts with /"); if (index == 0) { return null; diff --git a/ccm-ldn-aplaws/src/com/arsdigita/aplaws/ui/HomepageWorkspaceSelectionModel.java b/ccm-ldn-aplaws/src/com/arsdigita/aplaws/ui/HomepageWorkspaceSelectionModel.java index ca8201159..aabacc935 100755 --- a/ccm-ldn-aplaws/src/com/arsdigita/aplaws/ui/HomepageWorkspaceSelectionModel.java +++ b/ccm-ldn-aplaws/src/com/arsdigita/aplaws/ui/HomepageWorkspaceSelectionModel.java @@ -172,7 +172,7 @@ public class HomepageWorkspaceSelectionModel { Workspace custom = null; try { custom = global.retrieveSubworkspaceForParty(party); - Assert.truth(custom.getParty() != null && + Assert.isTrue(custom.getParty() != null && custom.getParty().equals(party), "party is not null and not admin"); s_log.debug("Found exsting personal workspce"); diff --git a/ccm-ldn-atoz/src/com/arsdigita/london/atoz/AtoZProviderType.java b/ccm-ldn-atoz/src/com/arsdigita/london/atoz/AtoZProviderType.java index 15ba4310a..111dd8e3d 100755 --- a/ccm-ldn-atoz/src/com/arsdigita/london/atoz/AtoZProviderType.java +++ b/ccm-ldn-atoz/src/com/arsdigita/london/atoz/AtoZProviderType.java @@ -39,11 +39,11 @@ public class AtoZProviderType { Class provider, Class providerCreate, Class providerAdmin) { - Assert.truth(AtoZProvider.class.isAssignableFrom(provider), + Assert.isTrue(AtoZProvider.class.isAssignableFrom(provider), "provider is a subclass of AtoZProvider"); - Assert.truth(ProviderAdmin.class.isAssignableFrom(providerAdmin), + Assert.isTrue(ProviderAdmin.class.isAssignableFrom(providerAdmin), "providerAdmin is a subclass of ProviderAdmin"); - Assert.truth(ProviderForm.class.isAssignableFrom(providerCreate), + Assert.isTrue(ProviderForm.class.isAssignableFrom(providerCreate), "providerCreate is a subclass of ProviderForm"); m_title = title; diff --git a/ccm-ldn-navigation/src/com/arsdigita/london/navigation/DataCollectionDefinition.java b/ccm-ldn-navigation/src/com/arsdigita/london/navigation/DataCollectionDefinition.java index eff8e2c4a..aaa1f9919 100755 --- a/ccm-ldn-navigation/src/com/arsdigita/london/navigation/DataCollectionDefinition.java +++ b/ccm-ldn-navigation/src/com/arsdigita/london/navigation/DataCollectionDefinition.java @@ -67,13 +67,13 @@ public class DataCollectionDefinition extends LockableImpl { private String m_dateAttribute = null; public final void setObjectType(String objectType) { - Assert.unlocked(this); + Assert.isUnlocked(this); validateObjectType(objectType); m_objectType = objectType; } public final void setSpecificObjectType(String specificObjectType) { - Assert.unlocked(this); + Assert.isUnlocked(this); if (specificObjectType != null) { validateObjectType(specificObjectType); @@ -82,7 +82,7 @@ public class DataCollectionDefinition extends LockableImpl { } public final void excludeSpecificObjectType( String specificObjectType ) { - Assert.unlocked( this ); + Assert.isUnlocked( this ); m_excludedTypes.add( specificObjectType ); } @@ -131,22 +131,22 @@ public class DataCollectionDefinition extends LockableImpl { } public final void setFilterCategory(boolean filterCategory) { - Assert.unlocked(this); + Assert.isUnlocked(this); m_filterCategory = filterCategory; } public final void setDescendCategories(boolean descendCategories) { - Assert.unlocked(this); + Assert.isUnlocked(this); m_descendCategories = descendCategories; } public final void setExcludeIndexObjects(boolean excludeIndexObjects) { - Assert.unlocked(this); + Assert.isUnlocked(this); m_excludeIndexObjects = excludeIndexObjects; } public final void setCheckPermissions(boolean checkPermissions) { - Assert.unlocked(this); + Assert.isUnlocked(this); m_checkPermissions = checkPermissions; } @@ -155,22 +155,22 @@ public class DataCollectionDefinition extends LockableImpl { * in the AtoZ module. */ public void setBlackListTypes(boolean blackListTypes) { - Assert.unlocked(this); + Assert.isUnlocked(this); m_blackListTypes = blackListTypes; } public final void addOrder(String order) { - Assert.unlocked(this); + Assert.isUnlocked(this); m_ordering.add(order); } public final void addProperty( DataCollectionProperty property ) { - Assert.unlocked( this ); + Assert.isUnlocked( this ); m_properties.add( property ); } public final DataCollection getDataCollection(NavigationModel model) { - Assert.locked(this); + Assert.isLocked(this); DataCollection objects = SessionManager.getSession() .retrieve(m_objectType); diff --git a/ccm-ldn-navigation/src/com/arsdigita/london/navigation/DataCollectionRenderer.java b/ccm-ldn-navigation/src/com/arsdigita/london/navigation/DataCollectionRenderer.java index f96cf7b8a..319749bae 100755 --- a/ccm-ldn-navigation/src/com/arsdigita/london/navigation/DataCollectionRenderer.java +++ b/ccm-ldn-navigation/src/com/arsdigita/london/navigation/DataCollectionRenderer.java @@ -64,17 +64,17 @@ public class DataCollectionRenderer extends LockableImpl { } public void addAttribute(String name) { - Assert.unlocked(this); + Assert.isUnlocked(this); m_attributes.add(name); } public void addProperty(DataCollectionPropertyRenderer pr) { - Assert.unlocked(this); + Assert.isUnlocked(this); m_properties.add(pr); } public void setPageSize(int pageSize) { - Assert.unlocked(this); + Assert.isUnlocked(this); m_pageSize = pageSize; } @@ -88,12 +88,12 @@ public class DataCollectionRenderer extends LockableImpl { } public void setSpecializeObjects(boolean specializeObjects) { - Assert.unlocked(this); + Assert.isUnlocked(this); m_specializeObjects = specializeObjects; } public void setWrapAttributes(boolean wrapAttributes) { - Assert.unlocked(this); + Assert.isUnlocked(this); m_wrapAttributes = wrapAttributes; } @@ -106,7 +106,7 @@ public class DataCollectionRenderer extends LockableImpl { */ public Element generateXML(DataCollection objects, int pageNumber) { - Assert.locked(this); + Assert.isLocked(this); // Quasimodo: Begin // If objects is empty, do not insert objectList-element but do insert noContent-element diff --git a/ccm-ldn-navigation/src/com/arsdigita/london/navigation/NavigationConfig.java b/ccm-ldn-navigation/src/com/arsdigita/london/navigation/NavigationConfig.java index d4e21bb17..94bbb5a66 100755 --- a/ccm-ldn-navigation/src/com/arsdigita/london/navigation/NavigationConfig.java +++ b/ccm-ldn-navigation/src/com/arsdigita/london/navigation/NavigationConfig.java @@ -56,10 +56,16 @@ import org.apache.log4j.Logger; public final class NavigationConfig extends AbstractConfig { private static final Logger s_log = Logger.getLogger(NavigationConfig.class); + /** The cache lifetime for category index pages in seconds. Default 1 hour */ private final Parameter m_indexPageCacheLifetime; + /** Generate full item URLs instead of going via search redirector. Default true */ private final Parameter m_generateItemURL; + /** The default category template. Default: /packages/navigation/templates/default.jsp */ private final Parameter m_defaultTemplate; + /** If no template for category, should it get template from parent, or + * fall back on default? Default: true */ private final Parameter m_inheritTemplates; + /** The URL of the default content section. Default: /content/ */ private final Parameter m_defaultContentSectionURL; private final Parameter m_relatedItemsContext; private final Parameter m_defaultModelClass; @@ -75,6 +81,8 @@ public final class NavigationConfig extends AbstractConfig { // Quasimodo: End private final Parameter m_dateOrderCategories; private final Parameter m_topLevelDateOrderCategories; + /** Class that provides categories included in menu for any categories that + * do not have an alternative provider registered */ private final Parameter m_defaultMenuCatProvider; private static Set s_fixedDateOrderCats = null; @@ -181,7 +189,8 @@ public final class NavigationConfig extends AbstractConfig { if( param.equals("false") || param.equals("adaptive") || param.equals("true")) { set(m_categoryMenuShowGrandChildren, param); } else { - s_log.error("com.arsdigita.london.navigation.category_menu_show_grand_children: Invalid setting " + param + ". Falling back to false."); + s_log.error("com.arsdigita.london.navigation.category_menu_show_grand_children: "+ + "Invalid setting " + param + ". Falling back to false."); set(m_categoryMenuShowGrandChildren, "false"); } // Quasimodo: End @@ -328,13 +337,14 @@ public final class NavigationConfig extends AbstractConfig { // non existent category id specified in configuration. Output warning to // logs and continue s_log.warn("Category with id " + topLevelCats[i] + - " specified in configuration as a top level date order category, but the category" + - "does not exist"); + " specified in configuration as a top level date order category, " + + "but the category does not exist"); } catch (NumberFormatException e) { // non number specified in configuration. Output warning to // logs and continue s_log.warn("Category with id " + topLevelCats[i] + - " specified in configuration as a top level date order category, but this is not a valid number"); + " specified in configuration as a top level date order category, "+ + "but this is not a valid number"); } } @@ -369,7 +379,8 @@ public final class NavigationConfig extends AbstractConfig { // non number specified in configuration. Output warning to // logs and continue s_log.warn("Category with id " + catArray[i] + - " specified in configuration as a date ordered category, but this is not a valid number"); + " specified in configuration as a date ordered category, "+ + "but this is not a valid number"); } s_fixedDateOrderCats.add(catArray[i]); } diff --git a/ccm-ldn-navigation/src/com/arsdigita/london/navigation/cms/CMSDataCollectionDefinition.java b/ccm-ldn-navigation/src/com/arsdigita/london/navigation/cms/CMSDataCollectionDefinition.java index c4f949dfa..7f3b89093 100755 --- a/ccm-ldn-navigation/src/com/arsdigita/london/navigation/cms/CMSDataCollectionDefinition.java +++ b/ccm-ldn-navigation/src/com/arsdigita/london/navigation/cms/CMSDataCollectionDefinition.java @@ -43,17 +43,17 @@ public class CMSDataCollectionDefinition extends DataCollectionDefinition { private String m_filterVersion = ContentItem.LIVE; protected void validateObjectType(ObjectType type) { - Assert.truth(type.isSubtypeOf(ContentItem.BASE_DATA_OBJECT_TYPE), + Assert.isTrue(type.isSubtypeOf(ContentItem.BASE_DATA_OBJECT_TYPE), "object type is a content item"); } public final void setFilterSection(boolean filterSection) { - Assert.unlocked(this); + Assert.isUnlocked(this); m_filterSection = filterSection; } public final void setFilterVersion(String version) { - Assert.unlocked(this); + Assert.isUnlocked(this); m_filterVersion = version; } diff --git a/ccm-ldn-navigation/src/com/arsdigita/london/navigation/ui/AbstractComponent.java b/ccm-ldn-navigation/src/com/arsdigita/london/navigation/ui/AbstractComponent.java index e12d172ce..7ec49bb8c 100755 --- a/ccm-ldn-navigation/src/com/arsdigita/london/navigation/ui/AbstractComponent.java +++ b/ccm-ldn-navigation/src/com/arsdigita/london/navigation/ui/AbstractComponent.java @@ -44,7 +44,7 @@ public abstract class AbstractComponent private NavigationModel m_model = Navigation.getConfig().getDefaultModel(); public void setModel(NavigationModel model) { - Assert.unlocked(this); + Assert.isUnlocked(this); m_model = model; } @@ -70,7 +70,7 @@ public abstract class AbstractComponent public final void generateXML(PageState state, Element parent) { - Assert.locked(this); + Assert.isLocked(this); Element content = generateXML(state.getRequest(), state.getResponse()); diff --git a/ccm-ldn-navigation/src/com/arsdigita/london/navigation/ui/AbstractContainer.java b/ccm-ldn-navigation/src/com/arsdigita/london/navigation/ui/AbstractContainer.java index 6ca92e28a..85539c6a3 100755 --- a/ccm-ldn-navigation/src/com/arsdigita/london/navigation/ui/AbstractContainer.java +++ b/ccm-ldn-navigation/src/com/arsdigita/london/navigation/ui/AbstractContainer.java @@ -36,7 +36,7 @@ public abstract class AbstractContainer extends AbstractComponent { public void add(Component child) { Assert.exists(child, Component.class); - Assert.truth(!m_children.contains(child)); + Assert.isTrue(!m_children.contains(child)); m_children.add(child); } diff --git a/ccm-ldn-navigation/src/com/arsdigita/london/navigation/ui/AbstractObjectList.java b/ccm-ldn-navigation/src/com/arsdigita/london/navigation/ui/AbstractObjectList.java index c6319ca9c..aa9094fc0 100755 --- a/ccm-ldn-navigation/src/com/arsdigita/london/navigation/ui/AbstractObjectList.java +++ b/ccm-ldn-navigation/src/com/arsdigita/london/navigation/ui/AbstractObjectList.java @@ -40,12 +40,12 @@ public abstract class AbstractObjectList private DataCollectionDefinition m_definition = new DataCollectionDefinition(); public final void setDefinition(DataCollectionDefinition definition) { - Assert.unlocked(this); + Assert.isUnlocked(this); m_definition = definition; } public final void setRenderer(DataCollectionRenderer renderer) { - Assert.unlocked(this); + Assert.isUnlocked(this); m_renderer = renderer; } @@ -75,7 +75,7 @@ public abstract class AbstractObjectList public Element generateObjectListXML(HttpServletRequest request, HttpServletResponse response) { - Assert.locked(this); + Assert.isLocked(this); String pageNumberValue = request.getParameter("pageNumber"); Integer pageNumber = null; diff --git a/ccm-ldn-navigation/src/com/arsdigita/london/navigation/ui/BebopComponentAdapter.java b/ccm-ldn-navigation/src/com/arsdigita/london/navigation/ui/BebopComponentAdapter.java index 8dfc121cc..accabecd9 100755 --- a/ccm-ldn-navigation/src/com/arsdigita/london/navigation/ui/BebopComponentAdapter.java +++ b/ccm-ldn-navigation/src/com/arsdigita/london/navigation/ui/BebopComponentAdapter.java @@ -37,7 +37,7 @@ public class BebopComponentAdapter extends SimpleComponent { } public void setComponent(Component component) { - Assert.unlocked(this); + Assert.isUnlocked(this); m_component = component; } @@ -48,7 +48,7 @@ public class BebopComponentAdapter extends SimpleComponent { public void generateXML(PageState state, Element parent) { - Assert.locked(this); + Assert.isLocked(this); Element content = m_component.generateXML(state.getRequest(), state.getResponse()); diff --git a/ccm-ldn-navigation/src/com/arsdigita/london/navigation/ui/RelatedItems.java b/ccm-ldn-navigation/src/com/arsdigita/london/navigation/ui/RelatedItems.java index c1fa9d7bf..54d971619 100755 --- a/ccm-ldn-navigation/src/com/arsdigita/london/navigation/ui/RelatedItems.java +++ b/ccm-ldn-navigation/src/com/arsdigita/london/navigation/ui/RelatedItems.java @@ -49,13 +49,13 @@ public class RelatedItems extends AbstractComponent { private int m_howMany = 15; public void setHowMany(int howMany) { - Assert.unlocked(this); + Assert.isUnlocked(this); m_howMany = howMany; } public Element generateXML(HttpServletRequest request, HttpServletResponse response) { - Assert.locked(this); + Assert.isLocked(this); NavigationModel model = getModel(); ACSObject obj = model.getObject(); diff --git a/ccm-ldn-navigation/src/com/arsdigita/london/navigation/ui/SimpleContainer.java b/ccm-ldn-navigation/src/com/arsdigita/london/navigation/ui/SimpleContainer.java index 9af108f4b..39ea74c08 100755 --- a/ccm-ldn-navigation/src/com/arsdigita/london/navigation/ui/SimpleContainer.java +++ b/ccm-ldn-navigation/src/com/arsdigita/london/navigation/ui/SimpleContainer.java @@ -38,7 +38,7 @@ public class SimpleContainer extends AbstractContainer { String xmlns) { Assert.exists(name, String.class); Assert.exists(xmlns, String.class); - Assert.truth(name.indexOf(":") != -1, "name is qualfied"); + Assert.isTrue(name.indexOf(":") != -1, "name is qualfied"); m_name = name; m_xmlns = xmlns; diff --git a/ccm-ldn-navigation/src/com/arsdigita/london/navigation/ui/URLComponent.java b/ccm-ldn-navigation/src/com/arsdigita/london/navigation/ui/URLComponent.java index 55e34d8b4..d79878ecf 100755 --- a/ccm-ldn-navigation/src/com/arsdigita/london/navigation/ui/URLComponent.java +++ b/ccm-ldn-navigation/src/com/arsdigita/london/navigation/ui/URLComponent.java @@ -39,7 +39,7 @@ public class URLComponent extends AbstractComponent { public Element generateXML(HttpServletRequest request, HttpServletResponse response) { - Assert.locked(this); + Assert.isLocked(this); Element content = Navigation.newElement("url"); diff --git a/ccm-ldn-navigation/src/com/arsdigita/london/navigation/ui/object/AtoZObjectList.java b/ccm-ldn-navigation/src/com/arsdigita/london/navigation/ui/object/AtoZObjectList.java index 138240828..3b6bf6d91 100755 --- a/ccm-ldn-navigation/src/com/arsdigita/london/navigation/ui/object/AtoZObjectList.java +++ b/ccm-ldn-navigation/src/com/arsdigita/london/navigation/ui/object/AtoZObjectList.java @@ -51,7 +51,7 @@ public class AtoZObjectList extends AbstractObjectList { private String m_titleProperty = ACSObject.DISPLAY_NAME; public void setTitleProperty(String property) { - Assert.locked(this); + Assert.isLocked(this); m_titleProperty = property; } diff --git a/ccm-ldn-portal/src/com/arsdigita/london/portal/Loader.java b/ccm-ldn-portal/src/com/arsdigita/london/portal/Loader.java index 0b03e4829..ba5f980ec 100755 --- a/ccm-ldn-portal/src/com/arsdigita/london/portal/Loader.java +++ b/ccm-ldn-portal/src/com/arsdigita/london/portal/Loader.java @@ -56,10 +56,6 @@ import com.arsdigita.web.ApplicationType; * @version $Id: Loader.java 1718 2008-07-16 14:08:38Z terry $ */ public class Loader extends PackageLoader { - // versionID no longer used as a system variable. version information is - // kept as part of java doc. - // public final static String versionId = "$Id: Loader.java 1718 2008-07-16 14:08:38Z terry $" - // + "$Author: terry $" + "$DateTime: 2004/03/02 06:33:42 $"; private static final Logger s_log = Logger.getLogger(Loader.class); diff --git a/ccm-ldn-portal/src/com/arsdigita/london/portal/Workspace.java b/ccm-ldn-portal/src/com/arsdigita/london/portal/Workspace.java index f1f9a6246..c0bf62eac 100755 --- a/ccm-ldn-portal/src/com/arsdigita/london/portal/Workspace.java +++ b/ccm-ldn-portal/src/com/arsdigita/london/portal/Workspace.java @@ -505,9 +505,9 @@ public class Workspace extends Application { * @param initial Single-character string, must be uppercase **/ public PartyCollection getParticipantsWithInitial(String initial) { - Assert.assertNotNull(initial); - Assert.assertTrue(initial.length() == 1, "Initial needs length 1"); - Assert.assertTrue(initial.equals(initial.toUpperCase()), + Assert.exists(initial); + Assert.isTrue(initial.length() == 1, "Initial needs length 1"); + Assert.isTrue(initial.equals(initial.toUpperCase()), "Initial must be uppercase"); //DataAssociationCursor dac = diff --git a/ccm-ldn-portal/src/com/arsdigita/london/portal/portlet/MyWorkspacesPortlet.java b/ccm-ldn-portal/src/com/arsdigita/london/portal/portlet/MyWorkspacesPortlet.java index 9e9cd1df0..c9219033c 100755 --- a/ccm-ldn-portal/src/com/arsdigita/london/portal/portlet/MyWorkspacesPortlet.java +++ b/ccm-ldn-portal/src/com/arsdigita/london/portal/portlet/MyWorkspacesPortlet.java @@ -50,20 +50,20 @@ public class MyWorkspacesPortlet extends AppPortlet { } protected DataQuery getMyPortalsDataQuery(Party party) { - Assert.assertTrue + Assert.isTrue (!isNew(), "You must save this portlet before you call " + "getMyPortalsDataQuery(User) on it."); DataQuery query = SessionManager.getSession().retrieveQuery ("com.arsdigita.london.portal.portlet.MyWorkspaces"); - Assert.assertNotNull(query, "query"); + Assert.exists(query, "query"); query.setParameter("userID", party.getID()); //Application parent = getParentApplication(); Application parent = Workspace.getCurrentlySelectedWorkspace(); - Assert.assertNotNull(parent, "parent"); + Assert.exists(parent, "parent"); query.setParameter ("personalWorkspaceID", parent.getID()); @@ -81,7 +81,7 @@ class MyWorkspacesPortletRenderer extends AbstractPortletRenderer { protected void generateBodyXML(PageState pageState, Element parent) { Party party = Kernel.getContext().getParty(); - Assert.assertNotNull(party, "party"); + Assert.exists(party, "party"); DataQuery query = m_portlet.getMyPortalsDataQuery(party); @@ -98,8 +98,8 @@ class MyWorkspacesPortletRenderer extends AbstractPortletRenderer { title = (String) query.get("title"); primaryURL = (String) query.get("primaryURL"); - Assert.assertNotNull(title, "title"); - Assert.assertNotNull(primaryURL, "primaryURL"); + Assert.exists(title, "title"); + Assert.exists(primaryURL, "primaryURL"); panel.add(new Link(title, primaryURL)); } diff --git a/ccm-ldn-portal/src/com/arsdigita/london/portal/ui/WorkspaceComponent.java b/ccm-ldn-portal/src/com/arsdigita/london/portal/ui/WorkspaceComponent.java index 45006569e..1bf82b472 100755 --- a/ccm-ldn-portal/src/com/arsdigita/london/portal/ui/WorkspaceComponent.java +++ b/ccm-ldn-portal/src/com/arsdigita/london/portal/ui/WorkspaceComponent.java @@ -174,7 +174,7 @@ public class WorkspaceComponent extends SimpleContainer { } public void setMultiPortal(boolean val) { - Assert.unlocked(this); + Assert.isUnlocked(this); m_multiPortal = val; } diff --git a/ccm-ldn-portal/src/com/arsdigita/london/portal/ui/WorkspaceTheme.java b/ccm-ldn-portal/src/com/arsdigita/london/portal/ui/WorkspaceTheme.java index 17a949fe4..0ec8c66f9 100755 --- a/ccm-ldn-portal/src/com/arsdigita/london/portal/ui/WorkspaceTheme.java +++ b/ccm-ldn-portal/src/com/arsdigita/london/portal/ui/WorkspaceTheme.java @@ -87,7 +87,7 @@ public class WorkspaceTheme extends ACSObject implements WorkspaceThemes { */ public static WorkspaceTheme retrieveWorkspaceTheme( BigDecimal WorkspaceThemeID) { - Assert.assertNotNull(WorkspaceThemeID); + Assert.exists(WorkspaceThemeID); return WorkspaceTheme.retrieveWorkspaceTheme(new OID( BASE_DATA_OBJECT_TYPE, WorkspaceThemeID)); @@ -102,7 +102,7 @@ public class WorkspaceTheme extends ACSObject implements WorkspaceThemes { * null if no WorkspaceTheme data object for this ID exists. */ public static WorkspaceTheme retrieveWorkspaceTheme(DataObject dataObject) { - Assert.assertNotNull(dataObject); + Assert.exists(dataObject); return new WorkspaceTheme(dataObject); } @@ -114,7 +114,7 @@ public class WorkspaceTheme extends ACSObject implements WorkspaceThemes { * the OID of the WorkspaceTheme to retrieve. */ public static WorkspaceTheme retrieveWorkspaceTheme(OID oid) { - Assert.assertNotNull(oid); + Assert.exists(oid); DataObject dataObject = SessionManager.getSession().retrieve(oid); @@ -143,7 +143,7 @@ public class WorkspaceTheme extends ACSObject implements WorkspaceThemes { public String getName() { String name = (String) get("theme_name"); - Assert.assertNotNull(name); + Assert.exists(name); return name; } @@ -153,7 +153,7 @@ public class WorkspaceTheme extends ACSObject implements WorkspaceThemes { * */ public void setName(String name) { - Assert.assertNotNull(name); + Assert.exists(name); set("theme_name", name); } @@ -165,7 +165,7 @@ public class WorkspaceTheme extends ACSObject implements WorkspaceThemes { public String getDescription() { String description = (String) get("theme_desc"); - Assert.assertNotNull(description); + Assert.exists(description); return description; } @@ -175,7 +175,7 @@ public class WorkspaceTheme extends ACSObject implements WorkspaceThemes { * */ public void setDescription(String desc) { - // Assert.assertNotNull(desc); + // Assert.exists(desc); set("theme_desc", desc); } diff --git a/ccm-ldn-portal/src/com/arsdigita/london/portal/ui/WorkspaceThemeCollection.java b/ccm-ldn-portal/src/com/arsdigita/london/portal/ui/WorkspaceThemeCollection.java index 86f9f34d8..a9ff99203 100755 --- a/ccm-ldn-portal/src/com/arsdigita/london/portal/ui/WorkspaceThemeCollection.java +++ b/ccm-ldn-portal/src/com/arsdigita/london/portal/ui/WorkspaceThemeCollection.java @@ -22,7 +22,7 @@ public class WorkspaceThemeCollection extends DomainCollection { public BigDecimal getID() { BigDecimal id = (BigDecimal) m_dataCollection.get("id"); - Assert.assertNotNull(id); + Assert.exists(id); return id; } @@ -35,7 +35,7 @@ public class WorkspaceThemeCollection extends DomainCollection { public DomainObject getDomainObject() { DomainObject domainObject = getWorkspaceTheme(); - Assert.assertNotNull(domainObject); + Assert.exists(domainObject); return domainObject; } @@ -51,7 +51,7 @@ public class WorkspaceThemeCollection extends DomainCollection { WorkspaceTheme workspaceTheme = WorkspaceTheme .retrieveWorkspaceTheme(dataObject); - Assert.assertNotNull(workspaceTheme); + Assert.exists(workspaceTheme); return workspaceTheme; } @@ -64,7 +64,7 @@ public class WorkspaceThemeCollection extends DomainCollection { public String getName() { String name = (String) m_dataCollection.get("theme_name"); - Assert.assertNotNull(name); + Assert.exists(name); return name; } diff --git a/ccm-ldn-rss/src/com/arsdigita/london/rss/Initializer.java b/ccm-ldn-rss/src/com/arsdigita/london/rss/Initializer.java index 8f4302188..dbeab0b9b 100755 --- a/ccm-ldn-rss/src/com/arsdigita/london/rss/Initializer.java +++ b/ccm-ldn-rss/src/com/arsdigita/london/rss/Initializer.java @@ -33,10 +33,6 @@ import com.arsdigita.runtime.RuntimeConfig; * @version $Id: Initializer.java 758 2005-09-02 14:26:56Z sskracic $ */ public class Initializer extends CompoundInitializer { - public final static String versionId = - "$Id: Initializer.java 758 2005-09-02 14:26:56Z sskracic $" + - "$Author: sskracic $" + - "$DateTime: 2003/10/28 14:24:00 $"; public Initializer() { final String url = RuntimeConfig.getConfig().getJDBCURL(); diff --git a/ccm-ldn-rss/src/com/arsdigita/london/rss/SimpleRSSItemCollection.java b/ccm-ldn-rss/src/com/arsdigita/london/rss/SimpleRSSItemCollection.java index c11fb1cee..9103abff3 100755 --- a/ccm-ldn-rss/src/com/arsdigita/london/rss/SimpleRSSItemCollection.java +++ b/ccm-ldn-rss/src/com/arsdigita/london/rss/SimpleRSSItemCollection.java @@ -40,7 +40,7 @@ public class SimpleRSSItemCollection implements RSSItemCollection { } public RSSItem getItem() { - Assert.truth(m_position >= 0 && m_position < m_items.length, + Assert.isTrue(m_position >= 0 && m_position < m_items.length, "position out of bounds"); return m_items[m_position]; diff --git a/ccm-ldn-search/src/com/arsdigita/london/search/SponsoredLink.java b/ccm-ldn-search/src/com/arsdigita/london/search/SponsoredLink.java index 2e2f5de89..27704c5c9 100755 --- a/ccm-ldn-search/src/com/arsdigita/london/search/SponsoredLink.java +++ b/ccm-ldn-search/src/com/arsdigita/london/search/SponsoredLink.java @@ -104,7 +104,7 @@ public class SponsoredLink extends ACSObject { * @return An {@link ACSObjectCollection} of SponsoredLinks that match the given term. **/ public static ACSObjectCollection retrieveLinksForTerm(String term) { - Assert.truth(term != null && term.length() > 0); + Assert.isTrue(term != null && term.length() > 0); ACSObjectCollection coll = retrieveAll(); coll.addEqualsFilter(SponsoredLink.TERM, term); @@ -142,7 +142,7 @@ public class SponsoredLink extends ACSObject { * @param title The new title. **/ public void setTitle(String title) { - Assert.truth(title != null && title.length() > 0); + Assert.isTrue(title != null && title.length() > 0); set(TITLE, title); } @@ -161,7 +161,7 @@ public class SponsoredLink extends ACSObject { * @param term The new term. **/ public void setTerm(String term) { - Assert.truth(term != null && term.length() > 0); + Assert.isTrue(term != null && term.length() > 0); set(TERM, term); } @@ -180,7 +180,7 @@ public class SponsoredLink extends ACSObject { * @param The new URL. **/ public void setURL(String url) { - Assert.truth(url != null && url.length() > 0); + Assert.isTrue(url != null && url.length() > 0); set(URL, url); } } diff --git a/ccm-ldn-subsite/src/com/arsdigita/london/subsite/Site.java b/ccm-ldn-subsite/src/com/arsdigita/london/subsite/Site.java index 2dabb942b..4d9fa1280 100755 --- a/ccm-ldn-subsite/src/com/arsdigita/london/subsite/Site.java +++ b/ccm-ldn-subsite/src/com/arsdigita/london/subsite/Site.java @@ -130,7 +130,7 @@ public class Site extends ACSObject { DataObject obj = sites.getDataObject(); if (sites.next()) { sites.close(); - Assert.truth(false, "hostname is unique"); + Assert.isTrue(false, "hostname is unique"); } return retrieve(obj); } diff --git a/ccm-ldn-terms/src/com/arsdigita/london/terms/Term.java b/ccm-ldn-terms/src/com/arsdigita/london/terms/Term.java index 5af873df2..ef7b90968 100755 --- a/ccm-ldn-terms/src/com/arsdigita/london/terms/Term.java +++ b/ccm-ldn-terms/src/com/arsdigita/london/terms/Term.java @@ -270,7 +270,7 @@ public class Term extends ACSObject { public void addNarrowerTerm(Term term, boolean isDefault, boolean isPreferred) { - //Assert.truth(term.getDomain().equals(getDomain()), + //Assert.isTrue(term.getDomain().equals(getDomain()), // "narrower term is in this domain"); if (s_log.isDebugEnabled()) { diff --git a/ccm-ldn-theme/src/com/arsdigita/london/theme/Theme.java b/ccm-ldn-theme/src/com/arsdigita/london/theme/Theme.java index 36c4bf023..6a974b390 100755 --- a/ccm-ldn-theme/src/com/arsdigita/london/theme/Theme.java +++ b/ccm-ldn-theme/src/com/arsdigita/london/theme/Theme.java @@ -108,7 +108,7 @@ public class Theme extends ACSObject { DataObject obj = themes.getDataObject(); if (themes.next()) { themes.close(); - Assert.truth(false, "url is unique"); + Assert.isTrue(false, "url is unique"); } return retrieve(obj); } diff --git a/ccm-ldn-theme/src/com/arsdigita/london/theme/ThemeFile.java b/ccm-ldn-theme/src/com/arsdigita/london/theme/ThemeFile.java index 023481450..74920aa0f 100755 --- a/ccm-ldn-theme/src/com/arsdigita/london/theme/ThemeFile.java +++ b/ccm-ldn-theme/src/com/arsdigita/london/theme/ThemeFile.java @@ -132,7 +132,7 @@ public class ThemeFile extends DomainObject { } public void setVersion(String version) { - Assert.assertTrue(LIVE.equals(version) || DRAFT.equals(version), "The version must be either " + LIVE + " or " + DRAFT + " but was actually " + version); + Assert.isTrue(LIVE.equals(version) || DRAFT.equals(version), "The version must be either " + LIVE + " or " + DRAFT + " but was actually " + version); set(VERSION, version); } diff --git a/ccm-ldn-theme/src/com/arsdigita/london/theme/util/ThemeFileUtil.java b/ccm-ldn-theme/src/com/arsdigita/london/theme/util/ThemeFileUtil.java index 105a0bdb2..94966de11 100755 --- a/ccm-ldn-theme/src/com/arsdigita/london/theme/util/ThemeFileUtil.java +++ b/ccm-ldn-theme/src/com/arsdigita/london/theme/util/ThemeFileUtil.java @@ -69,7 +69,7 @@ public class ThemeFileUtil { String serverSpecificPath, boolean overwriteNewerFiles, String fileType) { - Assert.assertTrue(ThemeFile.LIVE.equals(fileType) || + Assert.isTrue(ThemeFile.LIVE.equals(fileType) || ThemeFile.DRAFT.equals(fileType)); HashMap themeFiles = new HashMap(); ThemeFileCollection collection = null; diff --git a/ccm-ldn-util/src/com/arsdigita/london/util/db/ACSObjectInvariantCheck.java b/ccm-ldn-util/src/com/arsdigita/london/util/db/ACSObjectInvariantCheck.java index bd0639c97..63d2b02b9 100755 --- a/ccm-ldn-util/src/com/arsdigita/london/util/db/ACSObjectInvariantCheck.java +++ b/ccm-ldn-util/src/com/arsdigita/london/util/db/ACSObjectInvariantCheck.java @@ -110,7 +110,7 @@ public class ACSObjectInvariantCheck extends Program { com.redhat.persistence.metadata.ObjectType protoType = root.getRoot().getObjectType(type.getQualifiedName()); - Assert.truth(protoType != null, + Assert.isTrue(protoType != null, "null proto type for " + type.getQualifiedName()); final ObjectMap objectMap = root.getRoot().getObjectMap(protoType); diff --git a/ccm-ldn-util/src/com/arsdigita/london/util/ui/AbstractDomainObjectComponent.java b/ccm-ldn-util/src/com/arsdigita/london/util/ui/AbstractDomainObjectComponent.java index 83bfaebef..dca0edcb0 100755 --- a/ccm-ldn-util/src/com/arsdigita/london/util/ui/AbstractDomainObjectComponent.java +++ b/ccm-ldn-util/src/com/arsdigita/london/util/ui/AbstractDomainObjectComponent.java @@ -63,7 +63,7 @@ public abstract class AbstractDomainObjectComponent extends SimpleContainer { } public void respond(PageState state) { - Assert.locked(this); + Assert.isLocked(this); String name = state.getControlEventName(); String value = state.getControlEventValue(); @@ -99,7 +99,7 @@ public abstract class AbstractDomainObjectComponent extends SimpleContainer { } protected void fireDomainObjectActionEvent(DomainObjectActionEvent ev) { - Assert.locked(this); + Assert.isLocked(this); EventListenerList listeners = (EventListenerList)m_actions.get(ev.getAction()); @@ -112,7 +112,7 @@ public abstract class AbstractDomainObjectComponent extends SimpleContainer { } protected void registerDomainObjectAction(String action) { - Assert.unlocked(this); + Assert.isUnlocked(this); if (m_actions.containsKey(action)) { throw new RuntimeException("Action " + action + " already registered"); @@ -142,7 +142,7 @@ public abstract class AbstractDomainObjectComponent extends SimpleContainer { } public void addDomainObjectActionListener(String action, DomainObjectActionListener listener) { - Assert.unlocked(this); + Assert.isUnlocked(this); if (!m_actions.containsKey(action)) { throw new RuntimeException("Action " + action + " not registered"); @@ -155,7 +155,7 @@ public abstract class AbstractDomainObjectComponent extends SimpleContainer { protected String getDomainObjectActionLink(PageState state, DomainObject dobj, String action) { - Assert.locked(this); + Assert.isLocked(this); String url = null; state.setControlEvent(this, action, dobj.getOID().toString()); diff --git a/ccm-ldn-util/src/com/arsdigita/london/util/ui/AbstractDomainObjectDetails.java b/ccm-ldn-util/src/com/arsdigita/london/util/ui/AbstractDomainObjectDetails.java index ca75141d9..26400c689 100755 --- a/ccm-ldn-util/src/com/arsdigita/london/util/ui/AbstractDomainObjectDetails.java +++ b/ccm-ldn-util/src/com/arsdigita/london/util/ui/AbstractDomainObjectDetails.java @@ -106,7 +106,7 @@ public abstract class AbstractDomainObjectDetails if (party == null) { party = Kernel.getPublicUser(); } - Assert.truth(dobj.getObjectType().isSubtypeOf(ACSObject.BASE_DATA_OBJECT_TYPE), + Assert.isTrue(dobj.getObjectType().isSubtypeOf(ACSObject.BASE_DATA_OBJECT_TYPE), "I can only check permissions on ACS Objects - this domain Object is not a subtype of ACSObject "); PermissionDescriptor permission = new PermissionDescriptor(privilege,(ACSObject) dobj,party); actionVisible = PermissionService.checkPermission(permission); diff --git a/ccm-ldn-util/src/com/arsdigita/london/util/ui/AbstractDomainObjectList.java b/ccm-ldn-util/src/com/arsdigita/london/util/ui/AbstractDomainObjectList.java index ddfccc208..bf4968c30 100755 --- a/ccm-ldn-util/src/com/arsdigita/london/util/ui/AbstractDomainObjectList.java +++ b/ccm-ldn-util/src/com/arsdigita/london/util/ui/AbstractDomainObjectList.java @@ -134,7 +134,7 @@ public abstract class AbstractDomainObjectList party = Kernel.getPublicUser(); } Assert - .truth( + .isTrue( dobj.getObjectType().isSubtypeOf( ACSObject.BASE_DATA_OBJECT_TYPE), "I can only check permissions on ACS Objects - this domain Object is not a subtype of ACSObject "); diff --git a/ccm-ldn-util/src/com/arsdigita/london/util/ui/DomainObjectSelectionModel.java b/ccm-ldn-util/src/com/arsdigita/london/util/ui/DomainObjectSelectionModel.java index 375e9301f..2286f9fbd 100755 --- a/ccm-ldn-util/src/com/arsdigita/london/util/ui/DomainObjectSelectionModel.java +++ b/ccm-ldn-util/src/com/arsdigita/london/util/ui/DomainObjectSelectionModel.java @@ -46,7 +46,7 @@ public class DomainObjectSelectionModel extends AbstractSingleSelectionModel } public void setSelectedKey(PageState state, Object key) { - Assert.truth(key == null || + Assert.isTrue(key == null || key.getClass().equals(OID.class), "key must be an OID"); diff --git a/ccm-ldn-util/src/com/arsdigita/london/util/ui/ModalContainer.java b/ccm-ldn-util/src/com/arsdigita/london/util/ui/ModalContainer.java index f713e8fba..654577396 100755 --- a/ccm-ldn-util/src/com/arsdigita/london/util/ui/ModalContainer.java +++ b/ccm-ldn-util/src/com/arsdigita/london/util/ui/ModalContainer.java @@ -58,7 +58,7 @@ public class ModalContainer extends SimpleContainer implements Resettable { public void setDefaultMode(String name) { Assert.exists(name, String.class); - Assert.truth(m_modes.containsKey(name), + Assert.isTrue(m_modes.containsKey(name), "Mode " + name + " has been registered"); m_defaultMode = name; diff --git a/ccm-ldn-util/src/com/arsdigita/london/util/ui/parameters/DomainObjectParameter.java b/ccm-ldn-util/src/com/arsdigita/london/util/ui/parameters/DomainObjectParameter.java index 96906221e..965ad05e9 100755 --- a/ccm-ldn-util/src/com/arsdigita/london/util/ui/parameters/DomainObjectParameter.java +++ b/ccm-ldn-util/src/com/arsdigita/london/util/ui/parameters/DomainObjectParameter.java @@ -52,7 +52,7 @@ public class DomainObjectParameter extends ParameterModel { ObjectType type = MetadataRoot.getMetadataRoot() .getObjectType(objectType); - Assert.truth(type.isSubtypeOf(ACSObject.BASE_DATA_OBJECT_TYPE), + Assert.isTrue(type.isSubtypeOf(ACSObject.BASE_DATA_OBJECT_TYPE), objectType + " is a subtype of " + ACSObject.BASE_DATA_OBJECT_TYPE); } @@ -74,7 +74,7 @@ public class DomainObjectParameter extends ParameterModel { return dobj.getOID().toString(); } else { ACSObject dobj = (ACSObject)value; - Assert.truth( + Assert.isTrue( m_objectType.equals(dobj.getOID() .getObjectType() .getQualifiedName()), diff --git a/ccm-shp-aplaws/src/com/arsdigita/aplaws/ObjectTypeTraversal.java b/ccm-shp-aplaws/src/com/arsdigita/aplaws/ObjectTypeTraversal.java index 802d77164..64d21a34e 100755 --- a/ccm-shp-aplaws/src/com/arsdigita/aplaws/ObjectTypeTraversal.java +++ b/ccm-shp-aplaws/src/com/arsdigita/aplaws/ObjectTypeTraversal.java @@ -310,7 +310,7 @@ public abstract class ObjectTypeTraversal { protected String nameFromPath(String path) { int index = path.lastIndexOf("/"); - Assert.truth(index >= 0, "Path starts with /"); + Assert.isTrue(index >= 0, "Path starts with /"); if (path.endsWith("+")) { return path.substring(index + 1, path.length() - 2); @@ -321,7 +321,7 @@ public abstract class ObjectTypeTraversal { protected String parentFromPath(String path) { int index = path.lastIndexOf("/"); - Assert.truth(index >= 0, "Path starts with /"); + Assert.isTrue(index >= 0, "Path starts with /"); if (index == 0) { return null; diff --git a/ccm-shp-aplaws/src/com/arsdigita/aplaws/ui/HomepageWorkspaceSelectionModel.java b/ccm-shp-aplaws/src/com/arsdigita/aplaws/ui/HomepageWorkspaceSelectionModel.java index ca8201159..aabacc935 100755 --- a/ccm-shp-aplaws/src/com/arsdigita/aplaws/ui/HomepageWorkspaceSelectionModel.java +++ b/ccm-shp-aplaws/src/com/arsdigita/aplaws/ui/HomepageWorkspaceSelectionModel.java @@ -172,7 +172,7 @@ public class HomepageWorkspaceSelectionModel { Workspace custom = null; try { custom = global.retrieveSubworkspaceForParty(party); - Assert.truth(custom.getParty() != null && + Assert.isTrue(custom.getParty() != null && custom.getParty().equals(party), "party is not null and not admin"); s_log.debug("Found exsting personal workspce"); diff --git a/ccm-webpage/src/com/arsdigita/cms/webpage/installer/Initializer.java b/ccm-webpage/src/com/arsdigita/cms/webpage/installer/Initializer.java index 6a82568a1..72083845d 100755 --- a/ccm-webpage/src/com/arsdigita/cms/webpage/installer/Initializer.java +++ b/ccm-webpage/src/com/arsdigita/cms/webpage/installer/Initializer.java @@ -117,7 +117,7 @@ public class Initializer extends CompoundInitializer { //String section = (String) m_conf.getParameter(CONTENT_SECTION); String section = config.getContentSection(); - Assert.truth(section != null, "contentSection is null"); + Assert.isTrue(section != null, "contentSection is null"); config.setContentSection(section); diff --git a/ccm-webpage/src/com/arsdigita/cms/webpage/ui/WebpagePreviewPage.java b/ccm-webpage/src/com/arsdigita/cms/webpage/ui/WebpagePreviewPage.java index 4d6898616..5a404efb7 100755 --- a/ccm-webpage/src/com/arsdigita/cms/webpage/ui/WebpagePreviewPage.java +++ b/ccm-webpage/src/com/arsdigita/cms/webpage/ui/WebpagePreviewPage.java @@ -71,7 +71,7 @@ public class WebpagePreviewPage extends CMSPage { } } Assert.exists(webpage, Webpage.class); - Assert.truth(webpage.getContentSection().equals(section), "content section doesn't match!"); + Assert.isTrue(webpage.getContentSection().equals(section), "content section doesn't match!"); return webpage; } diff --git a/ccm-zes-aplaws/src/com/arsdigita/aplaws/ObjectTypeTraversal.java b/ccm-zes-aplaws/src/com/arsdigita/aplaws/ObjectTypeTraversal.java index 802d77164..64d21a34e 100644 --- a/ccm-zes-aplaws/src/com/arsdigita/aplaws/ObjectTypeTraversal.java +++ b/ccm-zes-aplaws/src/com/arsdigita/aplaws/ObjectTypeTraversal.java @@ -310,7 +310,7 @@ public abstract class ObjectTypeTraversal { protected String nameFromPath(String path) { int index = path.lastIndexOf("/"); - Assert.truth(index >= 0, "Path starts with /"); + Assert.isTrue(index >= 0, "Path starts with /"); if (path.endsWith("+")) { return path.substring(index + 1, path.length() - 2); @@ -321,7 +321,7 @@ public abstract class ObjectTypeTraversal { protected String parentFromPath(String path) { int index = path.lastIndexOf("/"); - Assert.truth(index >= 0, "Path starts with /"); + Assert.isTrue(index >= 0, "Path starts with /"); if (index == 0) { return null; diff --git a/ccm-zes-aplaws/src/com/arsdigita/aplaws/ui/HomepageWorkspaceSelectionModel.java b/ccm-zes-aplaws/src/com/arsdigita/aplaws/ui/HomepageWorkspaceSelectionModel.java index ca8201159..aabacc935 100644 --- a/ccm-zes-aplaws/src/com/arsdigita/aplaws/ui/HomepageWorkspaceSelectionModel.java +++ b/ccm-zes-aplaws/src/com/arsdigita/aplaws/ui/HomepageWorkspaceSelectionModel.java @@ -172,7 +172,7 @@ public class HomepageWorkspaceSelectionModel { Workspace custom = null; try { custom = global.retrieveSubworkspaceForParty(party); - Assert.truth(custom.getParty() != null && + Assert.isTrue(custom.getParty() != null && custom.getParty().equals(party), "party is not null and not admin"); s_log.debug("Found exsting personal workspce"); diff --git a/environment/project.xml.handbook b/environment/project.xml.handbook index acdad37bf..bd820b5c3 100644 --- a/environment/project.xml.handbook +++ b/environment/project.xml.handbook @@ -8,7 +8,7 @@ name="aplaws-handbook" prettyName="APLAWS plus" version="1-0-9" - release="rc-4" + release="rc-5" webxml="web.xml-aplaws" webapp="ROOT" xsi:schemaLocation="http://ccm.redhat.com/ccm-project file:tools-ng/common/xsd/project.xsd">