Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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.metamodel.sugarcrm;
import java.util.*;
import java.util.function.Supplier;
import org.apache.metamodel.schema.AbstractTable;
import org.apache.metamodel.schema.Column;
import org.apache.metamodel.schema.ColumnType;
import org.apache.metamodel.schema.MutableColumn;
import org.apache.metamodel.schema.Relationship;
import org.apache.metamodel.schema.Schema;
import org.apache.metamodel.schema.TableType;
import org.apache.metamodel.util.LazyRef;
import org.w3c.dom.Node;
import com.sugarcrm.ws.soap.FieldList;
import com.sugarcrm.ws.soap.NewModuleFields;
import com.sugarcrm.ws.soap.SelectFields;
import com.sugarcrm.ws.soap.SugarsoapPortType;
final class SugarCrmTable extends AbstractTable {
private static final long serialVersionUID = 1L;
private static final Map TYPE_MAPPING;
static {
TYPE_MAPPING = new HashMap();
// known string types
TYPE_MAPPING.put("name", ColumnType.VARCHAR);
TYPE_MAPPING.put("assigned_user_name", ColumnType.VARCHAR);
TYPE_MAPPING.put("text", ColumnType.VARCHAR);
TYPE_MAPPING.put("enum", ColumnType.VARCHAR);
TYPE_MAPPING.put("varchar", ColumnType.VARCHAR);
TYPE_MAPPING.put("phone", ColumnType.VARCHAR);
TYPE_MAPPING.put("fullname", ColumnType.VARCHAR);
TYPE_MAPPING.put("url", ColumnType.VARCHAR);
TYPE_MAPPING.put("relate", ColumnType.VARCHAR);
TYPE_MAPPING.put("email", ColumnType.VARCHAR);
TYPE_MAPPING.put("parent", ColumnType.VARCHAR);
TYPE_MAPPING.put("parent_type", ColumnType.VARCHAR);
TYPE_MAPPING.put("currency", ColumnType.VARCHAR);
TYPE_MAPPING.put("none", ColumnType.VARCHAR);
TYPE_MAPPING.put("user_name", ColumnType.VARCHAR);
TYPE_MAPPING.put("file", ColumnType.VARCHAR);
TYPE_MAPPING.put("id", ColumnType.VARCHAR);
// known numbers
TYPE_MAPPING.put("int", ColumnType.INTEGER);
// known booleans
TYPE_MAPPING.put("bool", ColumnType.BOOLEAN);
// known timebased
TYPE_MAPPING.put("date", ColumnType.DATE);
TYPE_MAPPING.put("datetime", ColumnType.DATE);
TYPE_MAPPING.put("datetimecombo", ColumnType.DATE);
}
private final String _name;
private final Schema _schema;
private final Supplier> _columnsRef;
public SugarCrmTable(String name, Schema schema, final SugarsoapPortType service, final Supplier sessionId) {
_name = name;
_schema = schema;
_columnsRef = new LazyRef>() {
@Override
protected List fetch() {
final List result = new ArrayList();
final String session = sessionId.get();
final NewModuleFields fields = service.getModuleFields(session, _name, new SelectFields());
final FieldList moduleFields = fields.getModuleFields();
final List