<%-- 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. --%> <%@ page import="java.util.*, java.io.*, java.net.*, java.sql.*, org.ofbiz.base.util.*, org.ofbiz.entity.*, org.ofbiz.entity.model.*, org.ofbiz.entity.datasource.*" %><% if(security.hasPermission("ENTITY_MAINT", session)) { String helperName = request.getParameter("helperName"); if(helperName == null || helperName.length() <= 0) { response.setContentType("text/html"); %> ModelInduceFromDB
Put the name of the Datasource in the EntityEngine.xml to induce from:
It's the datasource name. It doesn't need to be associated with a delegator, just defined in entityengine.xml.
Use the browser to view the source and see the entities that were created. <% } else { response.setContentType("text/xml"); Collection messages = new LinkedList(); GenericDAO dao = GenericDAO.getGenericDAO(new GenericHelperInfo(null, helperName)); List newEntList = dao.induceModelFromDb(messages); if(messages.size() > 0) { %> ERRORS: <% Iterator mIter = messages.iterator(); while(mIter.hasNext()) { %> <%=(String)mIter.next()%><% } } if(newEntList != null) { String title = "Entity of an Apache Open For Business Project (Apache OFBiz) Component"; String description = "None"; String copyright = "Copyright 2001-2012 The Apache Software Foundation"; String author = "None"; String version = "1.0"; %> <%=title%> <%=description%> <%=copyright%> <%=author%> <%=version%> <% Iterator ecIter = newEntList.iterator(); while(ecIter.hasNext()) { ModelEntity entity = (ModelEntity) ecIter.next(); %> table-name="<%=entity.getPlainTableName()%>"<%}%> package-name="<%=entity.getPackageName()%>"<%if(entity.getDependentOn().length() > 0){%> dependent-on="<%=entity.getDependentOn()%>"<%}%><%if(!title.equals(entity.getTitle())){%> title="<%=entity.getTitle()%>"<%}%><%if(!copyright.equals(entity.getCopyright())){%> copyright="<%=entity.getCopyright()%>"<%}%><%if(!author.equals(entity.getAuthor())){%> author="<%=entity.getAuthor()%>"<%}%><%if(!version.equals(entity.getVersion())){%> version="<%=entity.getVersion()%>"<%}%>><%if(!description.equals(entity.getDescription())){%> <%=entity.getDescription()%><%}%><% Iterator fieldIterator = entity.getFieldsIterator(); while (fieldIterator.hasNext()) { ModelField field = fieldIterator.next();%> col-name="<%=field.getColName()%>"<%}%> type="<%=field.getType()%>"><% for (int v = 0; v<% }%><% } Iterator pkIterator = entity.getPksIterator(); while (pkIterator.hasNext()) { ModelField field = pkIterator.next();%> <% } if (entity.getRelationsSize() > 0) { for (int r = 0; r < entity.getRelationsSize(); r++) { ModelRelation relation = entity.getRelation(r);%> 0){%> title="<%=relation.getTitle()%>"<%} %> rel-entity-name="<%=relation.getRelEntityName()%>"><%for(int km=0; km rel-field-name="<%=keyMap.getRelFieldName()%>"<%}%> /><%}%> <% } }%> <% }%> <% } } } else { %>ERROR: You do not have permission to use this page (ENTITY_MAINT needed)<% } %>