From: Hirzel P. <ph...@us...> - 2008-05-18 15:07:15
|
Update of /cvsroot/tcotool/TCO-Tool/src/org/tcotool/model In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv24829/src/org/tcotool/model Modified Files: CostCause.java CostCentre.java Log Message: Schema: #iliCode, #documentation Index: CostCause.java =================================================================== RCS file: /cvsroot/tcotool/TCO-Tool/src/org/tcotool/model/CostCause.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** CostCause.java 13 Jun 2007 20:15:54 -0000 1.4 --- CostCause.java 18 May 2008 15:07:13 -0000 1.5 *************** *** 1,5 **** --- 1,21 ---- package org.tcotool.model; + /* + * This library 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 library 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 library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ import org.tcotool.application.CostCauseDetailView; + import org.tcotool.tools.ModelUtility; import ch.softenvironment.client.ResourceManager; *************** *** 10,19 **** import ch.softenvironment.jomm.mvc.model.DbCode; import ch.softenvironment.jomm.mvc.model.DbCodeType; - import ch.softenvironment.util.DeveloperException; /** ! * @author generated by the umleditor */ public final class CostCause extends DbCode { ! // standard CodeCause's for the most TCO-Configuration public static final String INSTALLATION = "Installation"; public static final String SERVICE = "Service"; --- 26,37 ---- import ch.softenvironment.jomm.mvc.model.DbCode; import ch.softenvironment.jomm.mvc.model.DbCodeType; /** ! * Cause/kind of costs. According to Gartner these can be defined by 2 categories: ! * - direct costs ! * - indirect costs ! * @author Peter Hirzel <i>soft</i>Environment */ public final class CostCause extends DbCode { ! // IliCode => DIRECT costs: HW, SW, Operation, Administration public static final String INSTALLATION = "Installation"; public static final String SERVICE = "Service"; *************** *** 27,92 **** public static final String HARDWARE = "Hardware"; public static final String STORAGE = "Storage"; ! ! public CostCause(ch.softenvironment.jomm.DbObjectServer objectServer) { ! super(objectServer); ! } ! public static DbDescriptor createDescriptor(Class dbCode) { ! DbDescriptor descriptor = DbCode.createDescriptor(dbCode); ! descriptor.add(DbCodeType.PROPERTY_ILICODE, DbCode.ATTRIBUTE_ILICODE, new DbTextFieldDescriptor(DbCode.ILI_CODE_LENGTH), new DbMultiplicityRange(0, 1)); ! descriptor.add("direct","direct",new DbFieldTypeDescriptor(java.lang.Boolean.class),new DbMultiplicityRange(1,1)); ! return descriptor; ! } ! private String fieldIliCode; ! /** ! * Overwrites. ! */ ! public final String getIliCode() { ! return fieldIliCode; ! } ! /** ! * Makes sense here because morphed from CostType-DbEnumeration. ! * @param iliCode ! */ ! public final void setIliCode(String iliCode) { ! if (getIliCode() != null) { ! throw new DeveloperException("IliCode must not be changed!"); } ! ! String oldValue = fieldIliCode; ! fieldIliCode = iliCode; ! firePropertyChange("iliCode", oldValue, iliCode); ! } ! private Boolean fieldDirect; ! /** ! * ! */ ! public final Boolean getDirect() { ! return fieldDirect; ! } ! /** ! * According to Gartner costs may be "direct" or "indirect". ! * ! */ ! public void setDirect(Boolean direct) { ! Boolean oldValue = fieldDirect; ! fieldDirect = direct; ! firePropertyChange("direct", oldValue, direct); ! } ! /** ! * Overwrites ! */ ! public String getNameString() { ! String text = ""; ! // return getNameString(java.util.Locale.getDefault()); ! if (getName() != null) { ! text = getName().getValue(); ! if (getDirect().booleanValue()) { ! text = text + " [" + ResourceManager.getResourceAsNonLabeled(CostCauseDetailView.class, "LblDirect_text") + "]"; ! } else { ! text = text + " [" + ResourceManager.getResourceAsNonLabeled(CostCauseDetailView.class, "LblIndirect_text") + "]"; ! } ! } ! return text; ! } } \ No newline at end of file --- 45,121 ---- public static final String HARDWARE = "Hardware"; public static final String STORAGE = "Storage"; + // IliCode => CodeCause's standard types: INDIRECT + public static final String DOWNTIME = "Downtime"; // server down, non-productive time, etc + public static final String END_USER_OPERATION = "EndUserOperation"; // if peers educate other users, User-Support, Surfing, etc ! public static DbDescriptor createDescriptor(Class dbCode) { ! DbDescriptor descriptor = DbCode.createDescriptor(dbCode); ! descriptor.add("documentation", "documentation", new DbTextFieldDescriptor(1024), new DbMultiplicityRange(0,1)); ! descriptor.add(DbCodeType.PROPERTY_ILICODE, DbCode.ATTRIBUTE_ILICODE, new DbTextFieldDescriptor(DbCode.ILI_CODE_LENGTH), new DbMultiplicityRange(0, 1)); ! descriptor.add("direct", "direct", new DbFieldTypeDescriptor(java.lang.Boolean.class), new DbMultiplicityRange(1,1)); ! return descriptor; } ! public CostCause(ch.softenvironment.jomm.DbObjectServer objectServer) { ! super(objectServer); ! } ! ! private String fieldIliCode; ! /** ! * Overwrites. ! */ ! public final String getIliCode() { ! return fieldIliCode; ! } ! /** ! * Define UNIQUE identifier (INTERLIS enumerator). ! * @param iliCode ! */ ! public final void setIliCode(String iliCode) { ! //TODO check whether new code is UNIQUE among all CostCause's ! String oldValue = fieldIliCode; ! fieldIliCode = iliCode; ! firePropertyChange("iliCode", oldValue, iliCode); ! } ! private Boolean fieldDirect; ! public final Boolean getDirect() { ! return fieldDirect; ! } ! /** ! * According to Gartner costs may be "direct" or "indirect". ! */ ! public void setDirect(Boolean direct) { ! Boolean oldValue = fieldDirect; ! fieldDirect = direct; ! firePropertyChange("direct", oldValue, direct); ! } ! /** ! * Overwrites ! */ ! public String getNameString() { ! String text = ""; ! // return getNameString(java.util.Locale.getDefault()); ! if (getName() != null) { ! text = getName().getValue(ModelUtility.getCodeTypeLocale()); ! if (getDirect().booleanValue()) { ! text = text + " [" + ResourceManager.getResourceAsNonLabeled(CostCauseDetailView.class, "LblDirect_text") + "]"; ! } else { ! text = text + " [" + ResourceManager.getResourceAsNonLabeled(CostCauseDetailView.class, "LblIndirect_text") + "]"; ! } ! } ! return text; ! } ! private String fieldDocumentation; ! public String getDocumentation() { ! refresh(false); // read lazy initialized objects ! return fieldDocumentation; ! } ! /** ! * Note about CostCause. ! * @param documentation ! */ ! public void setDocumentation(String documentation){ ! String oldValue=fieldDocumentation; ! fieldDocumentation=documentation; ! firePropertyChange("documentation", oldValue, fieldDocumentation); ! } } \ No newline at end of file Index: CostCentre.java =================================================================== RCS file: /cvsroot/tcotool/TCO-Tool/src/org/tcotool/model/CostCentre.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** CostCentre.java 13 Jun 2007 20:15:54 -0000 1.2 --- CostCentre.java 18 May 2008 15:07:13 -0000 1.3 *************** *** 1,8 **** --- 1,79 ---- package org.tcotool.model; + /* + * This library 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 library 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 library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + import ch.softenvironment.jomm.descriptor.DbDescriptor; + import ch.softenvironment.jomm.descriptor.DbMultiplicityRange; + import ch.softenvironment.jomm.descriptor.DbTextFieldDescriptor; import ch.softenvironment.jomm.mvc.model.DbCode; + import ch.softenvironment.jomm.mvc.model.DbCodeType; + import ch.softenvironment.util.DeveloperException; + /** + * Cost centre. + * Accounting category. + * @author Peter Hirzel <i>soft</i>Environment + */ public final class CostCentre extends DbCode { + // IliCode => DIRECT costs: HW, SW, Operation, Administration + public static final String INTERNAL = "Internal"; + public static final String INFRASTRUCTURE = "Infrastructure"; + public static final String MERCHANDISING = "Merchandising"; + public static final String EDUCATION = "Education"; + public static final String ADMINISTRATION = "Administration"; + public static final String PRODUCTION = "Production"; + + public static DbDescriptor createDescriptor(Class dbCode) { + DbDescriptor descriptor = DbCode.createDescriptor(dbCode); + descriptor.add("documentation", "documentation", new DbTextFieldDescriptor(1024), new DbMultiplicityRange(0,1)); + descriptor.add(DbCodeType.PROPERTY_ILICODE, DbCode.ATTRIBUTE_ILICODE, new DbTextFieldDescriptor(DbCode.ILI_CODE_LENGTH), new DbMultiplicityRange(0, 1)); + //descriptor.add("direct","direct",new DbFieldTypeDescriptor(java.lang.Boolean.class),new DbMultiplicityRange(1,1)); + return descriptor; + } public CostCentre(ch.softenvironment.jomm.DbObjectServer objectServer) { super(objectServer); } + private String fieldIliCode; + /** + * Overwrites. + */ + public final String getIliCode() { + return fieldIliCode; + } + /** + * Makes sense here because morphed from CostType-DbEnumeration. + * @param iliCode + */ + public final void setIliCode(String iliCode) { + //TODO check whether new code is UNIQUE among all CostCentre's + String oldValue = fieldIliCode; + fieldIliCode = iliCode; + firePropertyChange("iliCode", oldValue, iliCode); + } + private String fieldDocumentation; + public String getDocumentation() { + refresh(false); // read lazy initialized objects + return fieldDocumentation; + } + /** + * Note about CostCause. + * @param documentation + */ + public void setDocumentation(String documentation){ + String oldValue=fieldDocumentation; + fieldDocumentation=documentation; + firePropertyChange("documentation", oldValue, fieldDocumentation); + } } |