ConstraintModel cm = (ConstraintModel) featureModelNGObject
.getInterface(de.FeatureModellingTool.FeatureModel.Manager.CONSTRAINT_MODEL_INTERFACE);
InteractionModel im = (InteractionModel) featureModelNGObject
.getInterface(de.FeatureModellingTool.FeatureModel.Manager.INTERACTION_MODEL_INTERFACE);
// gh start
CustomizationModel customizationModel = (CustomizationModel) featureModelNGObject
.getInterface(de.FeatureModellingTool.FeatureModel.Manager.CUSTOMIZATION_MODEL_INTERFACE);
// gh end
// begin д����Ŀ�����ļ�
StorableOutput textOutput = new StorableOutput(bufferStream);
textOutput.writeString(fm.getName());
textOutput.writeInt(drawingViews.length);
for (int i = 0; i < drawingViews.length; i++) {
textOutput.writeString(drawingViews[i].getDrawing()
.getTitle());
}
textOutput.close();
ZipEntry indexZipEntry = new ZipEntry("index.txt");
zipOutStream.putNextEntry(indexZipEntry);
bufferStream.writeTo(zipOutStream);
zipOutStream.closeEntry();
// end д����Ŀ�����ļ�
bufferStream.reset();
// begin д������ģ�������ļ�
FmdlParser parser = new FmdlParserPrototype();
parser.saveFmdl(bufferStream, fm);
ZipEntry fmZipEntry = new ZipEntry(fm.getName() + ".fm");
zipOutStream.putNextEntry(fmZipEntry);
bufferStream.writeTo(zipOutStream);
zipOutStream.closeEntry();
// end д������ģ�������ļ�
bufferStream.reset();
// begin д��Լ��ģ�������ļ�
parser.saveCmdl(bufferStream, cm, fm);
ZipEntry cmZipEntry = new ZipEntry(fm.getName() + ".cm");
zipOutStream.putNextEntry(cmZipEntry);
bufferStream.writeTo(zipOutStream);
zipOutStream.closeEntry();
// end д��Լ��ģ�������ļ�
bufferStream.reset();
// begin д�뽻��ģ�������ļ�
parser.saveImdl(bufferStream, im, fm);
ZipEntry imZipEntry = new ZipEntry(fm.getName() + ".im");
zipOutStream.putNextEntry(imZipEntry);
bufferStream.writeTo(zipOutStream);
zipOutStream.closeEntry();
// end д�뽻��ģ�������ļ�
bufferStream.reset();
// begin д����Ŀ��ͼ�ļ�
AdaptedStandardStorageFormat store = new AdaptedStandardStorageFormat();
for (int i = 0; i < drawingViews.length; i++) {
store.store(bufferStream, drawingViews[i].getDrawing());
ZipEntry viewZipEntry = new ZipEntry(
(String) drawingViews[i].getDrawing().getTitle()
+ ".draw");
zipOutStream.putNextEntry(viewZipEntry);
bufferStream.writeTo(zipOutStream);
zipOutStream.closeEntry();
bufferStream.reset();
}
// end д����Ŀ��ͼ�ļ�
bufferStream.reset();
// begin д��������Ϣ
GroupMap informationMap = (GroupMap) ProjectManagerImplementation.this
.getContext()
.getValue(
de.FeatureModellingTool.ProjectManager.ConstantDefinition.INFOMATION_MAP);
Iterator iterator = informationMap.keySet().iterator();
while (iterator.hasNext()) {
String id = (String) iterator.next();
Set set = informationMap.get(id);
if (set != null) {
Iterator valueIterator = set.iterator();
while (valueIterator.hasNext()) {
Drawing drawing = (Drawing) valueIterator.next();
store.store(bufferStream, drawing);
ZipEntry drawingEntry = new ZipEntry(id + "\\"
+ drawing.getTitle() + ".draw");
zipOutStream.putNextEntry(drawingEntry);
bufferStream.writeTo(zipOutStream);
zipOutStream.closeEntry();
bufferStream.reset();
}
}
}
// end д��������Ϣ
// begin д�붨����Ϣ
// gh start
CmdlParser cParser = new CmdlParserPrototype();
cParser
.saveCustomizationModel(bufferStream,
customizationModel);
ZipEntry customizationZipEntry = new ZipEntry(
"customization_index.txt");
zipOutStream.putNextEntry(customizationZipEntry);
bufferStream.writeTo(zipOutStream);
zipOutStream.closeEntry();
bufferStream.reset();
for (Iterator<String> itCVId = customizationModel
.getCustomizationVersionIds().iterator(); itCVId
.hasNext();) {
String cvId = itCVId.next();
cParser.saveCustomizationVersion(bufferStream,
customizationModel.getCustomizationVersion(cvId));
ZipEntry cvZipEntry = new ZipEntry(cParser
.getCustomizationVersionFileName(cvId));
zipOutStream.putNextEntry(cvZipEntry);
bufferStream.writeTo(zipOutStream);
zipOutStream.closeEntry();