Return-Path: X-Original-To: apmail-chemistry-commits-archive@www.apache.org Delivered-To: apmail-chemistry-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 164AE1786C for ; Mon, 6 Apr 2015 17:11:44 +0000 (UTC) Received: (qmail 25970 invoked by uid 500); 6 Apr 2015 17:11:44 -0000 Delivered-To: apmail-chemistry-commits-archive@chemistry.apache.org Received: (qmail 25839 invoked by uid 500); 6 Apr 2015 17:11:43 -0000 Mailing-List: contact commits-help@chemistry.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@chemistry.apache.org Delivered-To: mailing list commits@chemistry.apache.org Received: (qmail 24537 invoked by uid 99); 6 Apr 2015 17:11:42 -0000 Received: from eris.apache.org (HELO hades.apache.org) (140.211.11.105) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 06 Apr 2015 17:11:42 +0000 Received: from hades.apache.org (localhost [127.0.0.1]) by hades.apache.org (ASF Mail Server at hades.apache.org) with ESMTP id DB70EAC0E2F for ; Mon, 6 Apr 2015 17:11:42 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1671597 [13/23] - in /chemistry/site/trunk/content/java/0.13.0/maven/chemistry-opencmis-client/chemistry-opencmis-client-impl: ./ css/ images/ images/logos/ xref-test/ xref-test/org/ xref-test/org/apache/ xref-test/org/apache/chemistry/ xr... Date: Mon, 06 Apr 2015 17:11:40 -0000 To: commits@chemistry.apache.org From: gabriele@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20150406171142.DB70EAC0E2F@hades.apache.org> Added: chemistry/site/trunk/content/java/0.13.0/maven/chemistry-opencmis-client/chemistry-opencmis-client-impl/xref/org/apache/chemistry/opencmis/client/runtime/QueryResultImpl.html URL: http://svn.apache.org/viewvc/chemistry/site/trunk/content/java/0.13.0/maven/chemistry-opencmis-client/chemistry-opencmis-client-impl/xref/org/apache/chemistry/opencmis/client/runtime/QueryResultImpl.html?rev=1671597&view=auto ============================================================================== --- chemistry/site/trunk/content/java/0.13.0/maven/chemistry-opencmis-client/chemistry-opencmis-client-impl/xref/org/apache/chemistry/opencmis/client/runtime/QueryResultImpl.html (added) +++ chemistry/site/trunk/content/java/0.13.0/maven/chemistry-opencmis-client/chemistry-opencmis-client-impl/xref/org/apache/chemistry/opencmis/client/runtime/QueryResultImpl.html Mon Apr 6 17:11:39 2015 @@ -0,0 +1,173 @@ + + + + +QueryResultImpl xref + + + +
+
+1   /*
+2    * Licensed to the Apache Software Foundation (ASF) under one
+3    * or more contributor license agreements.  See the NOTICE file
+4    * distributed with this work for additional information
+5    * regarding copyright ownership.  The ASF licenses this file
+6    * to you under the Apache License, Version 2.0 (the
+7    * "License"); you may not use this file except in compliance
+8    * with the License.  You may obtain a copy of the License at
+9    *
+10   * http://www.apache.org/licenses/LICENSE-2.0
+11   *
+12   * Unless required by applicable law or agreed to in writing,
+13   * software distributed under the License is distributed on an
+14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+15   * KIND, either express or implied.  See the License for the
+16   * specific language governing permissions and limitations
+17   * under the License.
+18   */
+19  package org.apache.chemistry.opencmis.client.runtime;
+20  
+21  import java.io.Serializable;
+22  import java.util.ArrayList;
+23  import java.util.LinkedHashMap;
+24  import java.util.List;
+25  import java.util.Map;
+26  
+27  import org.apache.chemistry.opencmis.client.api.CmisObject;
+28  import org.apache.chemistry.opencmis.client.api.ObjectFactory;
+29  import org.apache.chemistry.opencmis.client.api.QueryResult;
+30  import org.apache.chemistry.opencmis.client.api.Relationship;
+31  import org.apache.chemistry.opencmis.client.api.Rendition;
+32  import org.apache.chemistry.opencmis.client.api.Session;
+33  import org.apache.chemistry.opencmis.commons.data.AllowableActions;
+34  import org.apache.chemistry.opencmis.commons.data.ObjectData;
+35  import org.apache.chemistry.opencmis.commons.data.PropertyData;
+36  import org.apache.chemistry.opencmis.commons.data.RenditionData;
+37  
+38  /**
+39   * Implementation of <code>QueryResult</code>.
+40   */
+41  public class QueryResultImpl implements QueryResult, Serializable {
+42  
+43      private static final long serialVersionUID = 1L;
+44  
+45      private Map<String, PropertyData<?>> propertiesById;
+46      private Map<String, PropertyData<?>> propertiesByQueryName;
+47      private AllowableActions allowableActions;
+48      private List<Relationship> relationships;
+49      private List<Rendition> renditions;
+50  
+51      /**
+52       * Constructor.
+53       */
+54      public QueryResultImpl(Session session, ObjectData objectData) {
+55          propertiesById = new LinkedHashMap<String, PropertyData<?>>();
+56          propertiesByQueryName = new LinkedHashMap<String, PropertyData<?>>();
+57  
+58          if (objectData != null) {
+59  
+60              ObjectFactory of = session.getObjectFactory();
+61  
+62              // handle properties
+63              if (objectData.getProperties() != null) {
+64                  List<PropertyData<?>> queryProperties = of.convertQueryProperties(objectData.getProperties());
+65  
+66                  for (PropertyData<?> property : queryProperties) {
+67                      propertiesById.put(property.getId(), property);
+68                      propertiesByQueryName.put(property.getQueryName(), property);
+69                  }
+70              }
+71  
+72              // handle allowable actions
+73              if (objectData.getAllowableActions() != null) {
+74                  this.allowableActions = objectData.getAllowableActions();
+75              }
+76  
+77              // handle relationships
+78              if (objectData.getRelationships() != null) {
+79                  relationships = new ArrayList<Relationship>();
+80                  for (ObjectData rod : objectData.getRelationships()) {
+81                      CmisObject relationship = of.convertObject(rod, session.getDefaultContext());
+82                      if (relationship instanceof Relationship) {
+83                          relationships.add((Relationship) relationship);
+84                      }
+85                  }
+86              }
+87  
+88              // handle renditions
+89              if (objectData.getRenditions() != null) {
+90                  this.renditions = new ArrayList<Rendition>();
+91                  for (RenditionData rd : objectData.getRenditions()) {
+92                      this.renditions.add(of.convertRendition(null, rd));
+93                  }
+94              }
+95          }
+96      }
+97  
+98      public List<PropertyData<?>> getProperties() {
+99          return new ArrayList<PropertyData<?>>(propertiesByQueryName.values());
+100     }
+101 
+102     @SuppressWarnings("unchecked")
+103     public <T> PropertyData<T> getPropertyById(String id) {
+104         return (PropertyData<T>) propertiesById.get(id);
+105     }
+106 
+107     @SuppressWarnings("unchecked")
+108     public <T> PropertyData<T> getPropertyByQueryName(String queryName) {
+109         return (PropertyData<T>) propertiesByQueryName.get(queryName);
+110     }
+111 
+112     public <T> T getPropertyValueById(String id) {
+113         PropertyData<T> property = getPropertyById(id);
+114         if (property == null) {
+115             return null;
+116         }
+117 
+118         return property.getFirstValue();
+119     }
+120 
+121     public <T> T getPropertyValueByQueryName(String queryName) {
+122         PropertyData<T> property = getPropertyByQueryName(queryName);
+123         if (property == null) {
+124             return null;
+125         }
+126 
+127         return property.getFirstValue();
+128     }
+129 
+130     public <T> List<T> getPropertyMultivalueById(String id) {
+131         PropertyData<T> property = getPropertyById(id);
+132         if (property == null) {
+133             return null;
+134         }
+135 
+136         return property.getValues();
+137     }
+138 
+139     public <T> List<T> getPropertyMultivalueByQueryName(String queryName) {
+140         PropertyData<T> property = getPropertyByQueryName(queryName);
+141         if (property == null) {
+142             return null;
+143         }
+144 
+145         return property.getValues();
+146     }
+147 
+148     public AllowableActions getAllowableActions() {
+149         return allowableActions;
+150     }
+151 
+152     public List<Relationship> getRelationships() {
+153         return relationships;
+154     }
+155 
+156     public List<Rendition> getRenditions() {
+157         return renditions;
+158     }
+159 }
+
+
+ +