/* * Decompiled with CFR 0.152. */ package com.tridium.sys.transfer; import com.tridium.sys.transfer.CompToComp; import com.tridium.sys.transfer.TransferResult; import java.util.ArrayList; import java.util.HashMap; import javax.baja.file.BIComponentFile; import javax.baja.space.Mark; import javax.baja.sys.BObject; public class FileToComp extends CompToComp { public TransferResult transfer() throws Exception { this.mark = this.filesToCompMark(); return super.transfer(); } private final Mark filesToCompMark() throws Exception { BObject[] bObjectArray = this.mark.getValues(); ArrayList arrayList = new ArrayList(); ArrayList arrayList2 = new ArrayList(); HashMap hashMap = new HashMap(bObjectArray.length * 2); int n = 0; while (n < bObjectArray.length) { if (bObjectArray[n] instanceof BIComponentFile) { Mark mark = ((BIComponentFile)((Object)bObjectArray[n])).readComponents(); BObject[] bObjectArray2 = mark.getValues(); String[] stringArray = mark.getNames(); int n2 = 0; while (n2 < bObjectArray2.length) { Object object; arrayList.add(stringArray[n2]); arrayList2.add(bObjectArray2[n2]); if (bObjectArray2[n2].isComponent() && (object = bObjectArray2[n2].asComponent().getHandle()) != null) { if (hashMap.containsKey(object)) { throw new Exception("Duplicate handles found in files, must transfer to component individually"); } hashMap.put(object, object); } ++n2; } } else { throw new Exception("Only IComponentFiles files may be transfered to a component"); } ++n; } return new Mark(arrayList2.toArray(new BObject[arrayList2.size()]), arrayList.toArray(new String[arrayList.size()])); } }