[portal-commits] JBoss Portal SVN: r12961 - modules/metadata/trunk/metadata/src/main/java/org/jboss/portal/metadata/portlet/adapter.

portal-commits at lists.jboss.org portal-commits at lists.jboss.org
Fri Mar 6 11:43:50 EST 2009


Author: mwringe
Date: 2009-03-06 11:43:50 -0500 (Fri, 06 Mar 2009)
New Revision: 12961

Added:
   modules/metadata/trunk/metadata/src/main/java/org/jboss/portal/metadata/portlet/adapter/LifeCycleStringAdapter.java
Log:
Add new lifecycle adapter to prepend _PHASE to the lifecycle string.

Added: modules/metadata/trunk/metadata/src/main/java/org/jboss/portal/metadata/portlet/adapter/LifeCycleStringAdapter.java
===================================================================
--- modules/metadata/trunk/metadata/src/main/java/org/jboss/portal/metadata/portlet/adapter/LifeCycleStringAdapter.java	                        (rev 0)
+++ modules/metadata/trunk/metadata/src/main/java/org/jboss/portal/metadata/portlet/adapter/LifeCycleStringAdapter.java	2009-03-06 16:43:50 UTC (rev 12961)
@@ -0,0 +1,51 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat                                               *
+ * Copyright 2008, Red Hat Middleware, LLC, and individual                    *
+ * contributors as indicated by the @authors tag. See the                     *
+ * copyright.txt in the distribution for a full listing of                    *
+ * individual contributors.                                                   *
+ *                                                                            *
+ * This is free software; you can redistribute it and/or modify it            *
+ * under the terms of the GNU Lesser General Public License as                *
+ * published by the Free Software Foundation; either version 2.1 of           *
+ * the License, or (at your option) any later version.                        *
+ *                                                                            *
+ * This software is distributed in the hope that it will be useful,           *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of             *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU           *
+ * Lesser General Public License for more details.                            *
+ *                                                                            *
+ * You should have received a copy of the GNU Lesser General Public           *
+ * License along with this software; if not, write to the Free                *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA         *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.                   *
+ ******************************************************************************/
+package org.jboss.portal.metadata.portlet.adapter;
+
+import javax.xml.bind.annotation.adapters.XmlAdapter;
+
+/**
+ * @author <a href="mailto:mwringe at redhat.com">Matt Wringe</a>
+ * @version $Revision$
+ */
+public class LifeCycleStringAdapter extends XmlAdapter<String, String>
+{
+
+   @Override
+   public String marshal(String v) throws Exception
+   {
+      throw new UnsupportedOperationException();
+   }
+
+   @Override
+   public String unmarshal(String lifeCycle) throws Exception
+   {
+      if (lifeCycle.toUpperCase().endsWith("_PHASE"))
+      {
+         return lifeCycle.substring(0, lifeCycle.toUpperCase().lastIndexOf("_PHASE"));
+      }  
+      return lifeCycle;
+   }
+
+}
+




More information about the portal-commits mailing list