You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@juddi.apache.org by al...@apache.org on 2014/01/09 03:11:16 UTC

svn commit: r1556699 - /juddi/trunk/juddi-client/src/main/java/org/apache/juddi/v3/client/mapping/Common2UDDI.java

Author: alexoree
Date: Thu Jan  9 02:11:16 2014
New Revision: 1556699

URL: http://svn.apache.org/r1556699
Log:
JUDDI-776 fixed for java clients

Added:
    juddi/trunk/juddi-client/src/main/java/org/apache/juddi/v3/client/mapping/Common2UDDI.java

Added: juddi/trunk/juddi-client/src/main/java/org/apache/juddi/v3/client/mapping/Common2UDDI.java
URL: http://svn.apache.org/viewvc/juddi/trunk/juddi-client/src/main/java/org/apache/juddi/v3/client/mapping/Common2UDDI.java?rev=1556699&view=auto
==============================================================================
--- juddi/trunk/juddi-client/src/main/java/org/apache/juddi/v3/client/mapping/Common2UDDI.java (added)
+++ juddi/trunk/juddi-client/src/main/java/org/apache/juddi/v3/client/mapping/Common2UDDI.java Thu Jan  9 02:11:16 2014
@@ -0,0 +1,56 @@
+/*
+ * Copyright 2014 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.juddi.v3.client.mapping;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.apache.juddi.v3.client.UDDIConstants;
+import org.uddi.api_v3.Description;
+
+/**
+ *
+ * @author Alex O'Ree
+ */
+public abstract class Common2UDDI {
+
+        public static List<Description> mapDescription(String content, String lang) {
+
+                List<Description> ret = new ArrayList<Description>();
+                if (content == null) {
+                        return ret;
+                }
+                System.out.println("enter " + content.length());
+                if (content.length() > UDDIConstants.MAX_description_length) {
+                        int offset = 0;
+                        while (offset < content.length()) {
+                                Description description = new Description();
+                                description.setLang(lang);
+                                int trim = offset + UDDIConstants.MAX_description_length;
+                                if (trim > content.length()) {
+                                        trim = content.length()-1;
+                                }
+                                description.setValue(content.substring(offset, trim));
+                                offset = offset + UDDIConstants.MAX_description_length;
+                                ret.add(description);
+                                
+                        }
+                } else {
+                        ret.add(new Description(content, lang));
+                }
+                return ret;
+
+        }
+}



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@juddi.apache.org
For additional commands, e-mail: commits-help@juddi.apache.org