001 //
002 // This file is generated by MetaBoss Ver 1.4.0001 at Thu Dec 15 22:36:26 EST 2005
003 // MetaBoss is Copyright 2000-2005 © Softaris Pty.Ltd. All Rights Reserved.
004 // Content of this file is Copyright 2000-2005 © Softaris Pty. Ltd. All Rights Reserved.
005 // This content is licensed under Open Source Gnu Public License (GPL)
006 // Full terms and conditions of GPL can be found found at www.gnu.org
007 //
008 // The generator class is com.metaboss.sdlctools.services.codegeneration.servicemoduleadaptergenerator.generic.stringstructures.BSAdapterGeneratorImpl
009 package com.almamater.crs.adapters.generic.stringstructures.services.coursesdomainsupport;
010
011 import com.metaboss.enterprise.datatypes.DataTypeValidationException;
012 import com.metaboss.enterprise.datatypes.DataTypeFieldValidationException;
013
014 /** This class contains utilities to translate data between enterprise data structure and string based data structure.
015 * This class is used internally in the adapter, but it can also be used for translation externally. */
016 public final class TRSTCourseDetails
017 {
018 private TRSTCourseDetails ()
019 {
020 }
021
022 public static com.almamater.crs.adapters.generic.stringstructures.services.coursesdomainsupport.PXSTCourseDetails[] toProxyArray(com.almamater.crs.services.coursesdomainsupport.STCourseDetails[] pStructArray)
023 {
024 if (pStructArray == null)
025 return null;
026 com.almamater.crs.adapters.generic.stringstructures.services.coursesdomainsupport.PXSTCourseDetails[] lReturn = new com.almamater.crs.adapters.generic.stringstructures.services.coursesdomainsupport.PXSTCourseDetails[pStructArray.length];
027 for (int i = 0; i < lReturn.length; i++)
028 lReturn[i] = toProxy(pStructArray[i]);
029 return lReturn;
030 }
031
032 public static com.almamater.crs.services.coursesdomainsupport.STCourseDetails[] fromProxyArray(com.almamater.crs.adapters.generic.stringstructures.services.coursesdomainsupport.PXSTCourseDetails[] pProxyArray) throws DataTypeFieldValidationException
033 {
034 if (pProxyArray == null)
035 return null;
036 com.almamater.crs.services.coursesdomainsupport.STCourseDetails[] lReturn = new com.almamater.crs.services.coursesdomainsupport.STCourseDetails[pProxyArray.length];
037 for (int i = 0; i < lReturn.length; i++)
038 lReturn[i] = fromProxy(pProxyArray[i]);
039 return lReturn;
040 }
041
042 public static com.almamater.crs.adapters.generic.stringstructures.services.coursesdomainsupport.PXSTCourseDetails toProxy(com.almamater.crs.services.coursesdomainsupport.STCourseDetails pStruct)
043 {
044 if (pStruct == null)
045 return null;
046 com.almamater.crs.adapters.generic.stringstructures.services.coursesdomainsupport.PXSTCourseDetails lProxy = new com.almamater.crs.adapters.generic.stringstructures.services.coursesdomainsupport.PXSTCourseDetails();
047 com.almamater.crs.types.system.courses.CourseInstanceId lInstanceId = pStruct.getInstanceId();
048 if (lInstanceId != null)
049 lProxy.InstanceId = lInstanceId.toString();
050 com.almamater.crs.types.system.courses.CourseVersionId lVersionId = pStruct.getVersionId();
051 if (lVersionId != null)
052 lProxy.VersionId = lVersionId.toString();
053 com.almamater.types.core.CourseCode lCode = pStruct.getCode();
054 if (lCode != null)
055 lProxy.Code = lCode.toString();
056 com.almamater.types.core.StringField lName = pStruct.getName();
057 if (lName != null)
058 lProxy.Name = lName.toString();
059 lProxy.Supervisor = com.almamater.crs.adapters.generic.stringstructures.services.coursesdomainsupport.TRSTTeacherKey.toProxy( pStruct.getSupervisor());
060 return lProxy;
061 }
062 public static com.almamater.crs.services.coursesdomainsupport.STCourseDetails fromProxy(com.almamater.crs.adapters.generic.stringstructures.services.coursesdomainsupport.PXSTCourseDetails pProxy) throws DataTypeFieldValidationException
063 {
064 if (pProxy == null)
065 return null;
066 com.almamater.crs.services.coursesdomainsupport.STCourseDetails lStruct = new com.almamater.crs.services.coursesdomainsupport.STCourseDetails();
067 try
068 {
069 if (pProxy.InstanceId != null)
070 lStruct.setInstanceId(com.almamater.crs.types.system.courses.CourseInstanceId.createFromString(pProxy.InstanceId));
071 }
072 catch (DataTypeValidationException e)
073 {
074 throw new DataTypeFieldValidationException("InstanceId", e);
075 }
076 try
077 {
078 if (pProxy.VersionId != null)
079 lStruct.setVersionId(com.almamater.crs.types.system.courses.CourseVersionId.createFromString(pProxy.VersionId));
080 }
081 catch (DataTypeValidationException e)
082 {
083 throw new DataTypeFieldValidationException("VersionId", e);
084 }
085 try
086 {
087 if (pProxy.Code != null)
088 lStruct.setCode(com.almamater.types.core.CourseCode.createFromString(pProxy.Code));
089 }
090 catch (DataTypeValidationException e)
091 {
092 throw new DataTypeFieldValidationException("Code", e);
093 }
094 try
095 {
096 if (pProxy.Name != null)
097 lStruct.setName(com.almamater.types.core.StringField.createFromString(pProxy.Name));
098 }
099 catch (DataTypeValidationException e)
100 {
101 throw new DataTypeFieldValidationException("Name", e);
102 }
103 try
104 {
105 lStruct.setSupervisor(com.almamater.crs.adapters.generic.stringstructures.services.coursesdomainsupport.TRSTTeacherKey.fromProxy( pProxy.Supervisor));
106 }
107 catch (DataTypeValidationException e)
108 {
109 throw new DataTypeFieldValidationException("Supervisor", e);
110 }
111 return lStruct;
112 }
113 }
|